mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 08:08:33 +00:00
Hide some views for Note to Self conversation.
This commit is contained in:
parent
dd717b60b8
commit
96f02d8c95
@ -137,12 +137,12 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
|||||||
});
|
});
|
||||||
|
|
||||||
boolean blocked = recipient.isBlocked();
|
boolean blocked = recipient.isBlocked();
|
||||||
blockButton.setVisibility(blocked ? View.GONE : View.VISIBLE);
|
blockButton .setVisibility(recipient.isLocalNumber() || blocked ? View.GONE : View.VISIBLE);
|
||||||
unblockButton.setVisibility(blocked ? View.VISIBLE : View.GONE);
|
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);
|
addContactButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
addContactButton.setVisibility(View.VISIBLE);
|
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.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 -> {
|
viewModel.getAdminActionStatus().observe(getViewLifecycleOwner(), adminStatus -> {
|
||||||
|
@ -54,12 +54,11 @@ final class RecipientDialogRepository {
|
|||||||
return groupId;
|
return groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getIdentity(@NonNull IdentityCallback callback) {
|
void getIdentity(@NonNull Consumer<IdentityDatabase.IdentityRecord> callback) {
|
||||||
SimpleTask.run(SignalExecutors.BOUNDED,
|
SignalExecutors.BOUNDED.execute(
|
||||||
() -> DatabaseFactory.getIdentityDatabase(context)
|
() -> callback.accept(DatabaseFactory.getIdentityDatabase(context)
|
||||||
.getIdentity(recipientId)
|
.getIdentity(recipientId)
|
||||||
.orNull(),
|
.orNull()));
|
||||||
callback::remoteIdentity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getRecipient(@NonNull RecipientCallback recipientCallback) {
|
void getRecipient(@NonNull RecipientCallback recipientCallback) {
|
||||||
@ -136,10 +135,6 @@ final class RecipientDialogRepository {
|
|||||||
onComplete::accept);
|
onComplete::accept);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IdentityCallback {
|
|
||||||
void remoteIdentity(@Nullable IdentityDatabase.IdentityRecord identityRecord);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RecipientCallback {
|
interface RecipientCallback {
|
||||||
void onRecipient(@NonNull Recipient recipient);
|
void onRecipient(@NonNull Recipient recipient);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,10 @@ final class RecipientDialogViewModel extends ViewModel {
|
|||||||
|
|
||||||
recipient = Recipient.live(recipientDialogRepository.getRecipientId()).getLiveData();
|
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() {
|
LiveData<Recipient> getRecipient() {
|
||||||
|
@ -74,12 +74,15 @@ public class ManageRecipientFragment extends Fragment {
|
|||||||
private TextView disappearingMessages;
|
private TextView disappearingMessages;
|
||||||
private View colorRow;
|
private View colorRow;
|
||||||
private ImageView colorChip;
|
private ImageView colorChip;
|
||||||
|
private View blockUnblockCard;
|
||||||
private TextView block;
|
private TextView block;
|
||||||
private TextView unblock;
|
private TextView unblock;
|
||||||
|
private View groupMembershipCard;
|
||||||
private TextView addToAGroup;
|
private TextView addToAGroup;
|
||||||
private SwitchCompat muteNotificationsSwitch;
|
private SwitchCompat muteNotificationsSwitch;
|
||||||
private View muteNotificationsRow;
|
private View muteNotificationsRow;
|
||||||
private TextView muteNotificationsUntilLabel;
|
private TextView muteNotificationsUntilLabel;
|
||||||
|
private View notificationsCard;
|
||||||
private TextView customNotificationsButton;
|
private TextView customNotificationsButton;
|
||||||
private View customNotificationsRow;
|
private View customNotificationsRow;
|
||||||
private View toggleAllGroups;
|
private View toggleAllGroups;
|
||||||
@ -120,13 +123,16 @@ public class ManageRecipientFragment extends Fragment {
|
|||||||
disappearingMessages = view.findViewById(R.id.disappearing_messages);
|
disappearingMessages = view.findViewById(R.id.disappearing_messages);
|
||||||
colorRow = view.findViewById(R.id.color_row);
|
colorRow = view.findViewById(R.id.color_row);
|
||||||
colorChip = view.findViewById(R.id.color_chip);
|
colorChip = view.findViewById(R.id.color_chip);
|
||||||
|
blockUnblockCard = view.findViewById(R.id.recipient_block_and_leave_card);
|
||||||
block = view.findViewById(R.id.block);
|
block = view.findViewById(R.id.block);
|
||||||
unblock = view.findViewById(R.id.unblock);
|
unblock = view.findViewById(R.id.unblock);
|
||||||
viewSafetyNumber = view.findViewById(R.id.view_safety_number);
|
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);
|
addToAGroup = view.findViewById(R.id.add_to_a_group);
|
||||||
muteNotificationsUntilLabel = view.findViewById(R.id.recipient_mute_notifications_until);
|
muteNotificationsUntilLabel = view.findViewById(R.id.recipient_mute_notifications_until);
|
||||||
muteNotificationsSwitch = view.findViewById(R.id.recipient_mute_notifications_switch);
|
muteNotificationsSwitch = view.findViewById(R.id.recipient_mute_notifications_switch);
|
||||||
muteNotificationsRow = view.findViewById(R.id.recipient_mute_notifications_row);
|
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);
|
customNotificationsButton = view.findViewById(R.id.recipient_custom_notifications_button);
|
||||||
customNotificationsRow = view.findViewById(R.id.recipient_custom_notifications_row);
|
customNotificationsRow = view.findViewById(R.id.recipient_custom_notifications_row);
|
||||||
toggleAllGroups = view.findViewById(R.id.toggle_all_groups);
|
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 = 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 -> {
|
viewModel.getCanCollapseMemberList().observe(getViewLifecycleOwner(), canCollapseMemberList -> {
|
||||||
if (canCollapseMemberList) {
|
if (canCollapseMemberList) {
|
||||||
toggleAllGroups.setVisibility(View.VISIBLE);
|
toggleAllGroups.setVisibility(View.VISIBLE);
|
||||||
@ -172,6 +175,15 @@ public class ManageRecipientFragment extends Fragment {
|
|||||||
|
|
||||||
if (recipientId.equals(Recipient.self().getId())) {
|
if (recipientId.equals(Recipient.self().getId())) {
|
||||||
toolbar.getMenu().findItem(R.id.action_edit).setVisible(true);
|
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);
|
viewModel.getName().observe(getViewLifecycleOwner(), name::setText);
|
||||||
@ -184,11 +196,6 @@ public class ManageRecipientFragment extends Fragment {
|
|||||||
block.setOnClickListener(v -> viewModel.onBlockClicked(requireActivity()));
|
block.setOnClickListener(v -> viewModel.onBlockClicked(requireActivity()));
|
||||||
unblock.setOnClickListener(v -> viewModel.onUnblockClicked(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 -> {
|
muteNotificationsRow.setOnClickListener(v -> {
|
||||||
if (muteNotificationsSwitch.isEnabled()) {
|
if (muteNotificationsSwitch.isEnabled()) {
|
||||||
muteNotificationsSwitch.toggle();
|
muteNotificationsSwitch.toggle();
|
||||||
@ -259,8 +266,8 @@ public class ManageRecipientFragment extends Fragment {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
secureCallButton.setVisibility(recipient.isRegistered() ? View.VISIBLE : View.GONE);
|
secureCallButton.setVisibility(recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||||
secureVideoCallButton.setVisibility(recipient.isRegistered() ? View.VISIBLE : View.GONE);
|
secureVideoCallButton.setVisibility(recipient.isRegistered() && !recipient.isLocalNumber() ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void presentMediaCursor(ManageRecipientViewModel.MediaCursor mediaCursor) {
|
private void presentMediaCursor(ManageRecipientViewModel.MediaCursor mediaCursor) {
|
||||||
|
@ -139,7 +139,9 @@
|
|||||||
android:paddingStart="20dp"
|
android:paddingStart="20dp"
|
||||||
android:paddingEnd="20dp"
|
android:paddingEnd="20dp"
|
||||||
android:text="@string/RecipientBottomSheet_view_safety_number"
|
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
|
<Button
|
||||||
android:id="@+id/rbs_make_group_admin_button"
|
android:id="@+id/rbs_make_group_admin_button"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user