use of org.thoughtcrime.securesms.components.SelectionAwareEmojiEditText in project Signal-Android by WhisperSystems.
the class ShareInterstitialActivity method initializeViews.
private void initializeViews(@NonNull MultiShareArgs args) {
confirm = findViewById(R.id.share_confirm);
toolbar = findViewById(R.id.toolbar);
preview = findViewById(R.id.link_preview);
confirm.setOnClickListener(unused -> onConfirm());
SelectionAwareEmojiEditText text = findViewById(R.id.text);
toolbar.setNavigationOnClickListener(unused -> finish());
text.addTextChangedListener(new AfterTextChanged(editable -> {
linkPreviewViewModel.onTextChanged(this, editable.toString(), text.getSelectionStart(), text.getSelectionEnd());
viewModel.onDraftTextChanged(editable.toString());
}));
// noinspection CodeBlock2Expr
text.setOnSelectionChangedListener(((selStart, selEnd) -> {
linkPreviewViewModel.onTextChanged(this, text.getText().toString(), text.getSelectionStart(), text.getSelectionEnd());
}));
preview.setCloseClickedListener(linkPreviewViewModel::onUserCancel);
int defaultRadius = getResources().getDimensionPixelSize(R.dimen.thumbnail_default_radius);
preview.setCorners(defaultRadius, defaultRadius);
text.setText(args.getDraftText());
ViewUtil.focusAndMoveCursorToEndAndOpenKeyboard(text);
contactsRecycler = findViewById(R.id.selected_list);
contactsRecycler.setAdapter(adapter);
RecyclerView.ItemAnimator itemAnimator = Objects.requireNonNull(contactsRecycler.getItemAnimator());
ShareFlowConstants.applySelectedContactsRecyclerAnimationSpeeds(itemAnimator);
confirm.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
int pad = Math.abs(v.getWidth() + ViewUtil.dpToPx(16));
ViewUtil.setPaddingEnd(contactsRecycler, pad);
});
}
Aggregations