Add call and message buttons to recipient bottom sheet.
And insecure call button for non-registered contacts.
This commit is contained in:
parent
80f9e1f4f1
commit
95d63b78f4
4 changed files with 65 additions and 24 deletions
|
@ -52,6 +52,8 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||||
private TextView usernameNumber;
|
private TextView usernameNumber;
|
||||||
private Button messageButton;
|
private Button messageButton;
|
||||||
private Button secureCallButton;
|
private Button secureCallButton;
|
||||||
|
private Button insecureCallButton;
|
||||||
|
private Button secureVideoCallButton;
|
||||||
private Button blockButton;
|
private Button blockButton;
|
||||||
private Button unblockButton;
|
private Button unblockButton;
|
||||||
private Button addContactButton;
|
private Button addContactButton;
|
||||||
|
@ -96,6 +98,8 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||||
usernameNumber = view.findViewById(R.id.rbs_username_number);
|
usernameNumber = view.findViewById(R.id.rbs_username_number);
|
||||||
messageButton = view.findViewById(R.id.rbs_message_button);
|
messageButton = view.findViewById(R.id.rbs_message_button);
|
||||||
secureCallButton = view.findViewById(R.id.rbs_secure_call_button);
|
secureCallButton = view.findViewById(R.id.rbs_secure_call_button);
|
||||||
|
insecureCallButton = view.findViewById(R.id.rbs_insecure_call_button);
|
||||||
|
secureVideoCallButton = view.findViewById(R.id.rbs_video_call_button);
|
||||||
blockButton = view.findViewById(R.id.rbs_block_button);
|
blockButton = view.findViewById(R.id.rbs_block_button);
|
||||||
unblockButton = view.findViewById(R.id.rbs_unblock_button);
|
unblockButton = view.findViewById(R.id.rbs_unblock_button);
|
||||||
addContactButton = view.findViewById(R.id.rbs_add_contact_button);
|
addContactButton = view.findViewById(R.id.rbs_add_contact_button);
|
||||||
|
@ -152,6 +156,8 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||||
unblockButton.setVisibility(recipient.isLocalNumber() || !blocked ? View.GONE : View.VISIBLE);
|
unblockButton.setVisibility(recipient.isLocalNumber() || !blocked ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
secureCallButton.setVisibility(recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
secureCallButton.setVisibility(recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||||
|
insecureCallButton.setVisibility(!recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||||
|
secureVideoCallButton.setVisibility(recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
if (recipient.isSystemContact() || recipient.isGroup() || recipient.isLocalNumber()) {
|
if (recipient.isSystemContact() || recipient.isGroup() || recipient.isLocalNumber()) {
|
||||||
addContactButton.setVisibility(View.GONE);
|
addContactButton.setVisibility(View.GONE);
|
||||||
|
@ -193,10 +199,9 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||||
viewModel.onMessageClicked(requireActivity());
|
viewModel.onMessageClicked(requireActivity());
|
||||||
});
|
});
|
||||||
|
|
||||||
secureCallButton.setOnClickListener(view -> {
|
secureCallButton.setOnClickListener(view -> viewModel.onSecureCallClicked(requireActivity()));
|
||||||
dismiss();
|
insecureCallButton.setOnClickListener(view -> viewModel.onInsecureCallClicked(requireActivity()));
|
||||||
viewModel.onSecureCallClicked(requireActivity());
|
secureVideoCallButton.setOnClickListener(view -> viewModel.onSecureVideoCallClicked(requireActivity()));
|
||||||
});
|
|
||||||
|
|
||||||
blockButton.setOnClickListener(view -> viewModel.onBlockClicked(requireActivity()));
|
blockButton.setOnClickListener(view -> viewModel.onBlockClicked(requireActivity()));
|
||||||
unblockButton.setOnClickListener(view -> viewModel.onUnblockClicked(requireActivity()));
|
unblockButton.setOnClickListener(view -> viewModel.onUnblockClicked(requireActivity()));
|
||||||
|
|
|
@ -99,6 +99,14 @@ final class RecipientDialogViewModel extends ViewModel {
|
||||||
recipientDialogRepository.getRecipient(recipient -> CommunicationActions.startVoiceCall(activity, recipient));
|
recipientDialogRepository.getRecipient(recipient -> CommunicationActions.startVoiceCall(activity, recipient));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onInsecureCallClicked(@NonNull FragmentActivity activity) {
|
||||||
|
recipientDialogRepository.getRecipient(recipient -> CommunicationActions.startInsecureCall(activity, recipient));
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSecureVideoCallClicked(@NonNull FragmentActivity activity) {
|
||||||
|
recipientDialogRepository.getRecipient(recipient -> CommunicationActions.startVideoCall(activity, recipient));
|
||||||
|
}
|
||||||
|
|
||||||
void onBlockClicked(@NonNull FragmentActivity activity) {
|
void onBlockClicked(@NonNull FragmentActivity activity) {
|
||||||
recipientDialogRepository.getRecipient(recipient -> BlockUnblockDialog.showBlockFor(activity, activity.getLifecycle(), recipient, () -> RecipientUtil.block(context, recipient)));
|
recipientDialogRepository.getRecipient(recipient -> BlockUnblockDialog.showBlockFor(activity, activity.getLifecycle(), recipient, () -> RecipientUtil.block(context, recipient)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,25 +63,51 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/rbs_username_number">
|
app:layout_constraintTop_toBottomOf="@+id/rbs_username_number">
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/rbs_message_button"
|
android:layout_width="wrap_content"
|
||||||
style="@style/Widget.Signal.Button.TextButton.Drawable"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_height="56dp"
|
android:layout_marginBottom="12dp">
|
||||||
android:paddingStart="20dp"
|
|
||||||
android:paddingEnd="20dp"
|
|
||||||
android:text="@string/RecipientBottomSheet_message"
|
|
||||||
app:drawableStartCompat="?attr/recipient_message_icon" />
|
|
||||||
|
|
||||||
<Button
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/rbs_secure_call_button"
|
android:id="@+id/rbs_message_button"
|
||||||
style="@style/Widget.Signal.Button.TextButton.Drawable"
|
style="@style/Widget.Signal.Button.Icon.Circular"
|
||||||
android:layout_width="match_parent"
|
android:contentDescription="@string/RecipientBottomSheet_message_description"
|
||||||
android:layout_height="56dp"
|
app:backgroundTint="?recipient_contact_button_color"
|
||||||
android:paddingStart="20dp"
|
app:icon="?recipient_message_circle_icon"
|
||||||
android:paddingEnd="20dp"
|
app:rippleColor="@color/core_ultramarine" />
|
||||||
android:text="@string/RecipientBottomSheet_call"
|
|
||||||
app:drawableStartCompat="?attr/recipient_call_icon" />
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/rbs_video_call_button"
|
||||||
|
style="@style/Widget.Signal.Button.Icon.Circular"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:contentDescription="@string/RecipientBottomSheet_video_call_description"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:backgroundTint="?recipient_contact_button_color"
|
||||||
|
app:icon="?recipient_video_call_circle_icon"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/rbs_secure_call_button"
|
||||||
|
style="@style/Widget.Signal.Button.Icon.Circular"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:contentDescription="@string/RecipientBottomSheet_voice_call_description"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:backgroundTint="?recipient_contact_button_color"
|
||||||
|
app:icon="?recipient_call_circle_icon"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/rbs_insecure_call_button"
|
||||||
|
style="@style/Widget.Signal.Button.Icon.Circular"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:contentDescription="@string/RecipientBottomSheet_insecure_voice_call_description"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:backgroundTint="?recipient_contact_button_color"
|
||||||
|
app:icon="?recipient_insecure_call_circle_icon"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/rbs_block_button"
|
android:id="@+id/rbs_block_button"
|
||||||
|
|
|
@ -2316,8 +2316,6 @@
|
||||||
<string name="Recipient_unknown">Unknown</string>
|
<string name="Recipient_unknown">Unknown</string>
|
||||||
|
|
||||||
<!-- RecipientBottomSheet -->
|
<!-- RecipientBottomSheet -->
|
||||||
<string name="RecipientBottomSheet_message">Message</string>
|
|
||||||
<string name="RecipientBottomSheet_call">Call</string>
|
|
||||||
<string name="RecipientBottomSheet_block">Block</string>
|
<string name="RecipientBottomSheet_block">Block</string>
|
||||||
<string name="RecipientBottomSheet_unblock">Unblock</string>
|
<string name="RecipientBottomSheet_unblock">Unblock</string>
|
||||||
<string name="RecipientBottomSheet_add_to_contacts">Add to contacts</string>
|
<string name="RecipientBottomSheet_add_to_contacts">Add to contacts</string>
|
||||||
|
@ -2327,6 +2325,10 @@
|
||||||
<string name="RecipientBottomSheet_make_group_admin">Make group admin</string>
|
<string name="RecipientBottomSheet_make_group_admin">Make group admin</string>
|
||||||
<string name="RecipientBottomSheet_remove_as_admin">Remove as admin</string>
|
<string name="RecipientBottomSheet_remove_as_admin">Remove as admin</string>
|
||||||
<string name="RecipientBottomSheet_remove_from_group">Remove from group</string>
|
<string name="RecipientBottomSheet_remove_from_group">Remove from group</string>
|
||||||
|
<string name="RecipientBottomSheet_message_description">Message</string>
|
||||||
|
<string name="RecipientBottomSheet_voice_call_description">Voice call</string>
|
||||||
|
<string name="RecipientBottomSheet_insecure_voice_call_description">Insecure voice call</string>
|
||||||
|
<string name="RecipientBottomSheet_video_call_description">Video call</string>
|
||||||
|
|
||||||
<string name="RecipientBottomSheet_remove_s_as_group_admin">Remove %1$s as group admin?</string>
|
<string name="RecipientBottomSheet_remove_s_as_group_admin">Remove %1$s as group admin?</string>
|
||||||
<string name="RecipientBottomSheet_s_will_be_able_to_edit_group">%1$s will be able to edit this group and its members</string>
|
<string name="RecipientBottomSheet_s_will_be_able_to_edit_group">%1$s will be able to edit this group and its members</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue