use of org.thoughtcrime.securesms.badges.BadgeImageView in project Signal-Android by WhisperSystems.
the class RecipientBottomSheetDialogFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.recipient_bottom_sheet, container, false);
avatar = view.findViewById(R.id.rbs_recipient_avatar);
fullName = view.findViewById(R.id.rbs_full_name);
about = view.findViewById(R.id.rbs_about);
usernameNumber = view.findViewById(R.id.rbs_username_number);
blockButton = view.findViewById(R.id.rbs_block_button);
unblockButton = view.findViewById(R.id.rbs_unblock_button);
addContactButton = view.findViewById(R.id.rbs_add_contact_button);
contactDetailsButton = view.findViewById(R.id.rbs_contact_details_button);
addToGroupButton = view.findViewById(R.id.rbs_add_to_group_button);
viewSafetyNumberButton = view.findViewById(R.id.rbs_view_safety_number_button);
makeGroupAdminButton = view.findViewById(R.id.rbs_make_group_admin_button);
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);
buttonStrip = view.findViewById(R.id.button_strip);
interactionsContainer = view.findViewById(R.id.interactions_container);
badgeImageView = view.findViewById(R.id.rbs_badge);
return view;
}
use of org.thoughtcrime.securesms.badges.BadgeImageView in project Signal-Android by WhisperSystems.
the class ConversationListFragment method initializeProfileIcon.
private void initializeProfileIcon(@NonNull Recipient recipient) {
ImageView icon = requireView().findViewById(R.id.toolbar_icon);
BadgeImageView imageView = requireView().findViewById(R.id.toolbar_badge);
imageView.setBadgeFromRecipient(recipient);
AvatarUtil.loadIconIntoImageView(recipient, icon, getResources().getDimensionPixelSize(R.dimen.toolbar_avatar_size));
}
use of org.thoughtcrime.securesms.badges.BadgeImageView in project Signal-Android by WhisperSystems.
the class PaymentDetailsFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
Toolbar toolbar = view.findViewById(R.id.payments_details_toolbar);
toolbar.setNavigationOnClickListener(v -> Navigation.findNavController(v).popBackStack());
PaymentDetailsParcelable details = PaymentDetailsFragmentArgs.fromBundle(requireArguments()).getPaymentDetails();
AvatarImageView avatar = view.findViewById(R.id.payments_details_avatar);
BadgeImageView badge = view.findViewById(R.id.payments_details_badge);
TextView contactFromTo = view.findViewById(R.id.payments_details_contact_to_from);
MoneyView amount = view.findViewById(R.id.payments_details_amount);
TextView note = view.findViewById(R.id.payments_details_note);
TextView status = view.findViewById(R.id.payments_details_status);
View sentByHeader = view.findViewById(R.id.payments_details_sent_by_header);
TextView sentBy = view.findViewById(R.id.payments_details_sent_by);
LearnMoreTextView transactionInfo = view.findViewById(R.id.payments_details_info);
TextView sentTo = view.findViewById(R.id.payments_details_sent_to_header);
MoneyView sentToAmount = view.findViewById(R.id.payments_details_sent_to_amount);
View sentFeeHeader = view.findViewById(R.id.payments_details_sent_fee_header);
MoneyView sentFeeAmount = view.findViewById(R.id.payments_details_sent_fee_amount);
Group sentViews = view.findViewById(R.id.payments_details_sent_views);
View blockHeader = view.findViewById(R.id.payments_details_block_header);
TextView blockNumber = view.findViewById(R.id.payments_details_block);
if (details.hasPayment()) {
Payment payment = details.requirePayment();
avatar.disableQuickContact();
avatar.setImageResource(R.drawable.ic_mobilecoin_avatar_24);
contactFromTo.setText(getContactFromToTextFromDirection(payment.getDirection()));
amount.setMoney(payment.getAmountPlusFeeWithDirection());
note.setVisibility(View.GONE);
status.setText(getStatusFromPayment(payment));
sentByHeader.setVisibility(View.GONE);
sentBy.setVisibility(View.GONE);
transactionInfo.setLearnMoreVisible(true);
transactionInfo.setText(R.string.PaymentsDetailsFragment__information);
transactionInfo.setLink(getString(R.string.PaymentsDetailsFragment__learn_more__information));
sentTo.setVisibility(View.GONE);
sentToAmount.setVisibility(View.GONE);
blockHeader.setVisibility(View.VISIBLE);
blockNumber.setVisibility(View.VISIBLE);
blockNumber.setText(String.valueOf(payment.getBlockIndex()));
if (payment.getDirection() == Direction.SENT) {
sentFeeAmount.setMoney(payment.getFee());
sentFeeHeader.setVisibility(View.VISIBLE);
sentFeeAmount.setVisibility(View.VISIBLE);
}
} else {
PaymentsDetailsViewModel viewModel = ViewModelProviders.of(this, new PaymentsDetailsViewModel.Factory(details.requireUuid())).get(PaymentsDetailsViewModel.class);
viewModel.getViewState().observe(getViewLifecycleOwner(), state -> {
if (state.getRecipient().getId().isUnknown() || state.getPayment().isDefrag()) {
avatar.disableQuickContact();
avatar.setImageResource(R.drawable.ic_mobilecoin_avatar_24);
} else {
avatar.setRecipient(state.getRecipient(), true);
badge.setBadgeFromRecipient(state.getRecipient());
}
contactFromTo.setText(describeToOrFrom(state));
if (state.getPayment().getState() == State.FAILED) {
amount.setTextColor(ContextCompat.getColor(requireContext(), R.color.signal_text_primary_disabled));
amount.setMoney(state.getPayment().getAmountPlusFeeWithDirection(), false);
transactionInfo.setVisibility(View.GONE);
} else {
amount.setMoney(state.getPayment().getAmountPlusFeeWithDirection());
if (state.getPayment().isDefrag()) {
transactionInfo.setLearnMoreVisible(true);
transactionInfo.setText(R.string.PaymentsDetailsFragment__coin_cleanup_information);
transactionInfo.setLink(getString(R.string.PaymentsDetailsFragment__learn_more__cleanup_fee));
} else {
transactionInfo.setLearnMoreVisible(true);
transactionInfo.setText(R.string.PaymentsDetailsFragment__information);
transactionInfo.setLink(getString(R.string.PaymentsDetailsFragment__learn_more__information));
}
transactionInfo.setVisibility(View.VISIBLE);
}
String trimmedNote = state.getPayment().getNote().trim();
note.setText(trimmedNote);
note.setVisibility(TextUtils.isEmpty(trimmedNote) ? View.GONE : View.VISIBLE);
status.setText(describeStatus(state.getPayment()));
sentBy.setText(describeSentBy(state));
if (state.getPayment().getDirection().isReceived()) {
sentToAmount.setMoney(Money.MobileCoin.ZERO);
sentFeeAmount.setMoney(Money.MobileCoin.ZERO);
sentViews.setVisibility(View.GONE);
} else {
sentTo.setText(describeSentTo(state, state.getPayment()));
sentToAmount.setMoney(state.getPayment().getAmount());
sentFeeAmount.setMoney(state.getPayment().getFee());
sentViews.setVisibility(View.VISIBLE);
}
});
viewModel.getPaymentExists().observe(getViewLifecycleOwner(), exists -> {
if (!exists) {
Log.w(TAG, "Failed to find payment detail");
FragmentActivity fragmentActivity = requireActivity();
fragmentActivity.onBackPressed();
Toast.makeText(fragmentActivity, R.string.PaymentsDetailsFragment__no_details_available, Toast.LENGTH_SHORT).show();
}
});
}
}
Aggregations