From a5a10eabcd89c853c43b4f436be548a8e908f4fd Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 2 Dec 2018 12:43:14 +0100 Subject: [PATCH] Handles the case of closed registrations. --- .../ui/views/GroupMembershipStatusView.java | 10 +++++++- .../layout/view_group_membership_status.xml | 24 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/GroupMembershipStatusView.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/GroupMembershipStatusView.java index 79de8ba..5ab1685 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/GroupMembershipStatusView.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/GroupMembershipStatusView.java @@ -9,6 +9,7 @@ import android.view.View; import android.widget.Button; import org.communiquons.android.comunic.client.R; +import org.communiquons.android.comunic.client.data.enums.GroupRegistrationLevel; import org.communiquons.android.comunic.client.data.models.GroupInfo; import org.communiquons.android.comunic.client.ui.listeners.OnGroupMembershipUpdateListener; @@ -31,6 +32,7 @@ public class GroupMembershipStatusView extends BaseFrameLayoutView implements Vi private Button joinButton; private ConstraintLayout memberForm; private Button leaveButton; + private ConstraintLayout closeRegistrationForm; /** * Group information @@ -64,6 +66,7 @@ public class GroupMembershipStatusView extends BaseFrameLayoutView implements Vi joinButton = view.findViewById(R.id.joinButton); memberForm = view.findViewById(R.id.memberForm); leaveButton = view.findViewById(R.id.leaveButton); + closeRegistrationForm = view.findViewById(R.id.closedRegistrationForm); //Show only one form showForm(respondInvitationForm); @@ -95,7 +98,10 @@ public class GroupMembershipStatusView extends BaseFrameLayoutView implements Vi switch (info.getMembershipLevel()) { case VISITOR: - showForm(requestForm); + if(info.getRegistrationLevel() == GroupRegistrationLevel.CLOSED) + showForm(closeRegistrationForm); + else + showForm(requestForm); return; case PENDING: @@ -125,6 +131,8 @@ public class GroupMembershipStatusView extends BaseFrameLayoutView implements Vi requestForm.setVisibility(v.equals(requestForm) ? View.VISIBLE : View.GONE); memberForm.setVisibility(v.equals(memberForm) ? View.VISIBLE : View.GONE); + closeRegistrationForm.setVisibility(v.equals(closeRegistrationForm) + ? View.VISIBLE : View.GONE); } diff --git a/app/src/main/res/layout/view_group_membership_status.xml b/app/src/main/res/layout/view_group_membership_status.xml index eb94f00..ceb1e0a 100644 --- a/app/src/main/res/layout/view_group_membership_status.xml +++ b/app/src/main/res/layout/view_group_membership_status.xml @@ -134,4 +134,28 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dc7a9aa..847868f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -313,4 +313,5 @@ Could not update group membership! Could not get group information! Access to the group denied. + Invitation only