Add copy to bottom sheet for Note to Self.

This commit is contained in:
Alan Evans 2020-06-18 14:34:30 -03:00 committed by GitHub
parent 021a16050a
commit 98d9b57379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 3 deletions

View file

@ -178,7 +178,7 @@ public final class AvatarImageView extends AppCompatImageView {
context.startActivity(ManageGroupActivity.newIntent(context, recipient.requireGroupId().requirePush()),
ManageGroupActivity.createTransitionBundle(context, this));
} else {
if (context instanceof FragmentActivity && !recipient.isLocalNumber()) {
if (context instanceof FragmentActivity) {
RecipientBottomSheetDialogFragment.create(recipient.getId(), null)
.show(((FragmentActivity) context).getSupportFragmentManager(), "BOTTOM");
} else {

View file

@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.groups.GroupId;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientExporter;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.util.CommunicationActions;
import org.thoughtcrime.securesms.util.ServiceUtil;
import org.thoughtcrime.securesms.util.ThemeUtil;
import org.thoughtcrime.securesms.util.Util;
@ -63,6 +64,7 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
private Button removeAdminButton;
private Button removeFromGroupButton;
private ProgressBar adminActionBusy;
private View noteToSelfDescription;
public static BottomSheetDialogFragment create(@NonNull RecipientId recipientId,
@Nullable GroupId groupId)
@ -109,6 +111,7 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
removeAdminButton = view.findViewById(R.id.rbs_remove_group_admin_button);
removeFromGroupButton = view.findViewById(R.id.rbs_remove_from_group_button);
adminActionBusy = view.findViewById(R.id.rbs_admin_action_busy);
noteToSelfDescription = view.findViewById(R.id.rbs_note_to_self_description);
return view;
}
@ -133,6 +136,12 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
}
});
avatar.setAvatar(recipient);
if (recipient.isLocalNumber()) {
avatar.setOnClickListener(v -> {
dismiss();
viewModel.onMessageClicked(requireActivity());
});
}
String name = recipient.isLocalNumber() ? requireContext().getString(R.string.note_to_self)
: recipient.getDisplayName(requireContext());
@ -151,10 +160,13 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
return true;
});
noteToSelfDescription.setVisibility(recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
boolean blocked = recipient.isBlocked();
blockButton .setVisibility(recipient.isLocalNumber() || blocked ? View.GONE : View.VISIBLE);
unblockButton.setVisibility(recipient.isLocalNumber() || !blocked ? View.GONE : View.VISIBLE);
messageButton.setVisibility(!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);

View file

@ -53,6 +53,24 @@
app:layout_constraintTop_toBottomOf="@+id/rbs_full_name"
tools:text="\@spidergwen +1 555-654-6657" />
<TextView
android:id="@+id/rbs_note_to_self_description"
style="@style/TextAppearance.Signal.Body2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:text="@string/ConversationFragment__you_can_add_notes_for_yourself_in_this_conversation"
android:textAlignment="center"
android:textColor="?attr/title_text_color_primary"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rbs_username_number"
tools:visibility="visible" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -61,7 +79,7 @@
android:paddingBottom="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rbs_username_number">
app:layout_constraintTop_toBottomOf="@+id/rbs_note_to_self_description">
<LinearLayout
android:layout_width="wrap_content"

View file

@ -317,7 +317,7 @@
<string name="ConversationFragment_you_can_swipe_to_the_left_reply">You can swipe to the left on any message to quickly reply</string>
<string name="ConversationFragment_outgoing_view_once_media_files_are_automatically_removed">Outgoing view-once media files are automatically removed after they are sent</string>
<string name="ConversationFragment_you_already_viewed_this_message">You already viewed this message</string>
<string name="ConversationFragment__you_can_add_notes_for_yourself_in_this_conversation">You can add notes for yourself in this conversation. If your account has any linked devices, new notes will be synced.</string>
<string name="ConversationFragment__you_can_add_notes_for_yourself_in_this_conversation">You can add notes for yourself in this conversation.\nIf your account has any linked devices, new notes will be synced.</string>
<!-- ConversationListActivity -->
<string name="ConversationListActivity_there_is_no_browser_installed_on_your_device">There is no browser installed on your device.</string>