Handles the case of closed registrations.

This commit is contained in:
Pierre HUBERT 2018-12-02 12:43:14 +01:00
parent 5ee02aea0a
commit a5a10eabcd
3 changed files with 34 additions and 1 deletions

View File

@ -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,6 +98,9 @@ public class GroupMembershipStatusView extends BaseFrameLayoutView implements Vi
switch (info.getMembershipLevel()) {
case VISITOR:
if(info.getRegistrationLevel() == GroupRegistrationLevel.CLOSED)
showForm(closeRegistrationForm);
else
showForm(requestForm);
return;
@ -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);
}

View File

@ -134,4 +134,28 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:id="@+id/closedRegistrationForm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/memberForm">
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:text="@string/notice_closed_registration"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -313,4 +313,5 @@
<string name="err_update_group_membership">Could not update group membership!</string>
<string name="err_get_group_info">Could not get group information!</string>
<string name="notice_group_access_denied">Access to the group denied.</string>
<string name="notice_closed_registration">Invitation only</string>
</resources>