Show pending count and allow view of zero pending screen.

This commit is contained in:
Alan Evans 2020-05-26 14:25:53 -03:00 committed by Greyson Parrelli
parent 82ba7e2b8b
commit 4cda267f3b
3 changed files with 45 additions and 17 deletions

View File

@ -62,7 +62,8 @@ public class ManageGroupFragment extends Fragment {
private ManageGroupViewModel viewModel; private ManageGroupViewModel viewModel;
private GroupMemberListView groupMemberList; private GroupMemberListView groupMemberList;
private View listPending; private View pendingMembersRow;
private TextView pendingMembersCount;
private Toolbar toolbar; private Toolbar toolbar;
private TextView memberCountUnderAvatar; private TextView memberCountUnderAvatar;
private TextView memberCountAboveList; private TextView memberCountAboveList;
@ -124,7 +125,8 @@ public class ManageGroupFragment extends Fragment {
memberCountUnderAvatar = view.findViewById(R.id.member_count); memberCountUnderAvatar = view.findViewById(R.id.member_count);
memberCountAboveList = view.findViewById(R.id.member_count_2); memberCountAboveList = view.findViewById(R.id.member_count_2);
groupMemberList = view.findViewById(R.id.group_members); groupMemberList = view.findViewById(R.id.group_members);
listPending = view.findViewById(R.id.listPending); pendingMembersRow = view.findViewById(R.id.pending_members_row);
pendingMembersCount = view.findViewById(R.id.pending_members_count);
threadPhotoRailView = view.findViewById(R.id.recent_photos); threadPhotoRailView = view.findViewById(R.id.recent_photos);
groupMediaCard = view.findViewById(R.id.group_media_card); groupMediaCard = view.findViewById(R.id.group_media_card);
accessControlCard = view.findViewById(R.id.group_access_control_card); accessControlCard = view.findViewById(R.id.group_access_control_card);
@ -171,16 +173,15 @@ public class ManageGroupFragment extends Fragment {
}); });
viewModel.getPendingMemberCount().observe(getViewLifecycleOwner(), viewModel.getPendingMemberCount().observe(getViewLifecycleOwner(),
members -> { pendingInviteCount -> {
if (members > 0) { pendingMembersRow.setOnClickListener(v -> {
listPending.setEnabled(true); FragmentActivity activity = requireActivity();
listPending.setOnClickListener(v -> { activity.startActivity(PendingMemberInvitesActivity.newIntent(activity, groupId.requireV2()));
FragmentActivity activity = requireActivity(); });
activity.startActivity(PendingMemberInvitesActivity.newIntent(activity, groupId.requireV2())); if (pendingInviteCount == 0) {
}); pendingMembersCount.setText(R.string.ManageGroupActivity_none);
} else { } else {
listPending.setEnabled(false); pendingMembersCount.setText(getResources().getQuantityString(R.plurals.ManageGroupActivity_invited, pendingInviteCount, pendingInviteCount));
listPending.setOnClickListener(null);
} }
}); });

View File

@ -403,12 +403,34 @@
app:cardBackgroundColor="?android:attr/windowBackground" app:cardBackgroundColor="?android:attr/windowBackground"
app:layout_constraintTop_toBottomOf="@id/group_membership_card"> app:layout_constraintTop_toBottomOf="@id/group_membership_card">
<Button <LinearLayout
android:id="@+id/listPending" android:id="@+id/pending_members_row"
style="@style/Widget.Signal.Button.TextButton" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="@dimen/group_manage_fragment_row_height"
android:layout_height="wrap_content" android:background="?selectableItemBackground"
android:text="@string/ManageGroupActivity_pending_group_invites" /> android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:paddingStart="@dimen/group_manage_fragment_row_horizontal_padding"
android:paddingEnd="@dimen/group_manage_fragment_row_horizontal_padding">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical|start"
android:text="@string/ManageGroupActivity_pending_group_invites"
android:textAppearance="@style/TextAppearance.Signal.Body2" />
<TextView
android:id="@+id/pending_members_count"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|end"
android:textAppearance="@style/TextAppearance.Signal.Body2"
android:textColor="@color/ultramarine_text_button"
tools:text="@string/ManageGroupActivity_none" />
</LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View File

@ -516,6 +516,11 @@
<string name="ManageGroupActivity_add_members">Add members</string> <string name="ManageGroupActivity_add_members">Add members</string>
<string name="ManageGroupActivity_view_all_members">View all members</string> <string name="ManageGroupActivity_view_all_members">View all members</string>
<string name="ManageGroupActivity_none">None</string>
<plurals name="ManageGroupActivity_invited">
<item quantity="other">%d invited</item>
</plurals>
<string name="ManageGroupActivity_you_dont_have_the_rights_to_do_this">You don\'t have the rights to do this</string> <string name="ManageGroupActivity_you_dont_have_the_rights_to_do_this">You don\'t have the rights to do this</string>
<string name="ManageGroupActivity_not_capable">Someone you added does not support new groups and needs to update Signal</string> <string name="ManageGroupActivity_not_capable">Someone you added does not support new groups and needs to update Signal</string>
<string name="ManageGroupActivity_failed_to_update_the_group">Failed to update the group</string> <string name="ManageGroupActivity_failed_to_update_the_group">Failed to update the group</string>