kopia lustrzana https://github.com/ryukoposting/Signal-Android
Hide some views for Note to Self conversation.
rodzic
dd717b60b8
commit
96f02d8c95
|
@ -137,12 +137,12 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
});
|
||||
|
||||
boolean blocked = recipient.isBlocked();
|
||||
blockButton.setVisibility(blocked ? View.GONE : View.VISIBLE);
|
||||
unblockButton.setVisibility(blocked ? View.VISIBLE : View.GONE);
|
||||
blockButton .setVisibility(recipient.isLocalNumber() || blocked ? View.GONE : View.VISIBLE);
|
||||
unblockButton.setVisibility(recipient.isLocalNumber() || !blocked ? View.GONE : View.VISIBLE);
|
||||
|
||||
secureCallButton.setVisibility(recipient.isRegistered() ? View.VISIBLE : View.GONE);
|
||||
secureCallButton.setVisibility(recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (recipient.isSystemContact() || recipient.isGroup()) {
|
||||
if (recipient.isSystemContact() || recipient.isGroup() || recipient.isLocalNumber()) {
|
||||
addContactButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
addContactButton.setVisibility(View.VISIBLE);
|
||||
|
@ -152,7 +152,7 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
}
|
||||
|
||||
addToGroupButton.setText(groupId == null ? R.string.RecipientBottomSheet_add_to_a_group : R.string.RecipientBottomSheet_add_to_another_group);
|
||||
addToGroupButton.setVisibility(recipient.isRegistered() && !recipient.isGroup() ? View.VISIBLE : View.GONE);
|
||||
addToGroupButton.setVisibility(recipient.isRegistered() && !recipient.isGroup() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||
});
|
||||
|
||||
viewModel.getAdminActionStatus().observe(getViewLifecycleOwner(), adminStatus -> {
|
||||
|
|
|
@ -54,12 +54,11 @@ final class RecipientDialogRepository {
|
|||
return groupId;
|
||||
}
|
||||
|
||||
void getIdentity(@NonNull IdentityCallback callback) {
|
||||
SimpleTask.run(SignalExecutors.BOUNDED,
|
||||
() -> DatabaseFactory.getIdentityDatabase(context)
|
||||
.getIdentity(recipientId)
|
||||
.orNull(),
|
||||
callback::remoteIdentity);
|
||||
void getIdentity(@NonNull Consumer<IdentityDatabase.IdentityRecord> callback) {
|
||||
SignalExecutors.BOUNDED.execute(
|
||||
() -> callback.accept(DatabaseFactory.getIdentityDatabase(context)
|
||||
.getIdentity(recipientId)
|
||||
.orNull()));
|
||||
}
|
||||
|
||||
void getRecipient(@NonNull RecipientCallback recipientCallback) {
|
||||
|
@ -136,10 +135,6 @@ final class RecipientDialogRepository {
|
|||
onComplete::accept);
|
||||
}
|
||||
|
||||
interface IdentityCallback {
|
||||
void remoteIdentity(@Nullable IdentityDatabase.IdentityRecord identityRecord);
|
||||
}
|
||||
|
||||
interface RecipientCallback {
|
||||
void onRecipient(@NonNull Recipient recipient);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,10 @@ final class RecipientDialogViewModel extends ViewModel {
|
|||
|
||||
recipient = Recipient.live(recipientDialogRepository.getRecipientId()).getLiveData();
|
||||
|
||||
recipientDialogRepository.getIdentity(identity::setValue);
|
||||
boolean isSelf = recipientDialogRepository.getRecipientId().equals(Recipient.self().getId());
|
||||
if (!isSelf) {
|
||||
recipientDialogRepository.getIdentity(identity::postValue);
|
||||
}
|
||||
}
|
||||
|
||||
LiveData<Recipient> getRecipient() {
|
||||
|
|
|
@ -74,12 +74,15 @@ public class ManageRecipientFragment extends Fragment {
|
|||
private TextView disappearingMessages;
|
||||
private View colorRow;
|
||||
private ImageView colorChip;
|
||||
private View blockUnblockCard;
|
||||
private TextView block;
|
||||
private TextView unblock;
|
||||
private View groupMembershipCard;
|
||||
private TextView addToAGroup;
|
||||
private SwitchCompat muteNotificationsSwitch;
|
||||
private View muteNotificationsRow;
|
||||
private TextView muteNotificationsUntilLabel;
|
||||
private View notificationsCard;
|
||||
private TextView customNotificationsButton;
|
||||
private View customNotificationsRow;
|
||||
private View toggleAllGroups;
|
||||
|
@ -120,13 +123,16 @@ public class ManageRecipientFragment extends Fragment {
|
|||
disappearingMessages = view.findViewById(R.id.disappearing_messages);
|
||||
colorRow = view.findViewById(R.id.color_row);
|
||||
colorChip = view.findViewById(R.id.color_chip);
|
||||
blockUnblockCard = view.findViewById(R.id.recipient_block_and_leave_card);
|
||||
block = view.findViewById(R.id.block);
|
||||
unblock = view.findViewById(R.id.unblock);
|
||||
viewSafetyNumber = view.findViewById(R.id.view_safety_number);
|
||||
groupMembershipCard = view.findViewById(R.id.recipient_membership_card);
|
||||
addToAGroup = view.findViewById(R.id.add_to_a_group);
|
||||
muteNotificationsUntilLabel = view.findViewById(R.id.recipient_mute_notifications_until);
|
||||
muteNotificationsSwitch = view.findViewById(R.id.recipient_mute_notifications_switch);
|
||||
muteNotificationsRow = view.findViewById(R.id.recipient_mute_notifications_row);
|
||||
notificationsCard = view.findViewById(R.id.recipient_notifications_card);
|
||||
customNotificationsButton = view.findViewById(R.id.recipient_custom_notifications_button);
|
||||
customNotificationsRow = view.findViewById(R.id.recipient_custom_notifications_row);
|
||||
toggleAllGroups = view.findViewById(R.id.toggle_all_groups);
|
||||
|
@ -146,9 +152,6 @@ public class ManageRecipientFragment extends Fragment {
|
|||
|
||||
viewModel = ViewModelProviders.of(requireActivity(), factory).get(ManageRecipientViewModel.class);
|
||||
|
||||
viewModel.getVisibleSharedGroups().observe(getViewLifecycleOwner(), members -> sharedGroupList.setMembers(members));
|
||||
viewModel.getSharedGroupsCountSummary().observe(getViewLifecycleOwner(), members -> groupsInCommonCount.setText(members));
|
||||
|
||||
viewModel.getCanCollapseMemberList().observe(getViewLifecycleOwner(), canCollapseMemberList -> {
|
||||
if (canCollapseMemberList) {
|
||||
toggleAllGroups.setVisibility(View.VISIBLE);
|
||||
|
@ -172,6 +175,15 @@ public class ManageRecipientFragment extends Fragment {
|
|||
|
||||
if (recipientId.equals(Recipient.self().getId())) {
|
||||
toolbar.getMenu().findItem(R.id.action_edit).setVisible(true);
|
||||
notificationsCard.setVisibility(View.GONE);
|
||||
groupMembershipCard.setVisibility(View.GONE);
|
||||
blockUnblockCard.setVisibility(View.GONE);
|
||||
} else {
|
||||
viewModel.getVisibleSharedGroups().observe(getViewLifecycleOwner(), members -> sharedGroupList.setMembers(members));
|
||||
viewModel.getSharedGroupsCountSummary().observe(getViewLifecycleOwner(), members -> groupsInCommonCount.setText(members));
|
||||
addToAGroup.setOnClickListener(v -> viewModel.onAddToGroupButton(requireActivity()));
|
||||
sharedGroupList.setRecipientClickListener(recipient -> viewModel.onGroupClicked(requireActivity(), recipient));
|
||||
sharedGroupList.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
}
|
||||
|
||||
viewModel.getName().observe(getViewLifecycleOwner(), name::setText);
|
||||
|
@ -184,11 +196,6 @@ public class ManageRecipientFragment extends Fragment {
|
|||
block.setOnClickListener(v -> viewModel.onBlockClicked(requireActivity()));
|
||||
unblock.setOnClickListener(v -> viewModel.onUnblockClicked(requireActivity()));
|
||||
|
||||
addToAGroup.setOnClickListener(v -> viewModel.onAddToGroupButton(requireActivity()));
|
||||
|
||||
sharedGroupList.setRecipientClickListener(recipient -> viewModel.onGroupClicked(requireActivity(), recipient));
|
||||
sharedGroupList.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
|
||||
muteNotificationsRow.setOnClickListener(v -> {
|
||||
if (muteNotificationsSwitch.isEnabled()) {
|
||||
muteNotificationsSwitch.toggle();
|
||||
|
@ -259,8 +266,8 @@ public class ManageRecipientFragment extends Fragment {
|
|||
return true;
|
||||
});
|
||||
|
||||
secureCallButton.setVisibility(recipient.isRegistered() ? View.VISIBLE : View.GONE);
|
||||
secureVideoCallButton.setVisibility(recipient.isRegistered() ? View.VISIBLE : View.GONE);
|
||||
secureCallButton.setVisibility(recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||
secureVideoCallButton.setVisibility(recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void presentMediaCursor(ManageRecipientViewModel.MediaCursor mediaCursor) {
|
||||
|
|
|
@ -139,7 +139,9 @@
|
|||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/RecipientBottomSheet_view_safety_number"
|
||||
app:drawableStartCompat="?attr/recipient_view_safety_icon" />
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="?attr/recipient_view_safety_icon"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/rbs_make_group_admin_button"
|
||||
|
|
Ładowanie…
Reference in New Issue