Search in sources :

Example 1 with MultiShareArgs

use of org.thoughtcrime.securesms.sharing.MultiShareArgs 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);
    });
}
Also used : Context(android.content.Context) Bundle(android.os.Bundle) Stream(com.annimon.stream.Stream) NonNull(androidx.annotation.NonNull) Intent(android.content.Intent) ViewUtil(org.thoughtcrime.securesms.util.ViewUtil) R(org.thoughtcrime.securesms.R) DynamicTheme(org.thoughtcrime.securesms.util.DynamicTheme) View(android.view.View) ViewModelProviders(androidx.lifecycle.ViewModelProviders) Recipient(org.thoughtcrime.securesms.recipients.Recipient) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinkPreviewView(org.thoughtcrime.securesms.components.LinkPreviewView) CircularProgressButton(com.dd.CircularProgressButton) AfterTextChanged(org.thoughtcrime.securesms.util.text.AfterTextChanged) LinkPreviewViewModel(org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator) Objects(java.util.Objects) PassphraseRequiredActivity(org.thoughtcrime.securesms.PassphraseRequiredActivity) SelectionAwareEmojiEditText(org.thoughtcrime.securesms.components.SelectionAwareEmojiEditText) LinkPreviewRepository(org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository) DynamicNoActionBarTheme(org.thoughtcrime.securesms.util.DynamicNoActionBarTheme) MultiShareArgs(org.thoughtcrime.securesms.sharing.MultiShareArgs) MultiShareDialogs(org.thoughtcrime.securesms.sharing.MultiShareDialogs) Toolbar(androidx.appcompat.widget.Toolbar) ShareFlowConstants(org.thoughtcrime.securesms.sharing.ShareFlowConstants) GlideApp(org.thoughtcrime.securesms.mms.GlideApp) RecyclerView(androidx.recyclerview.widget.RecyclerView) AfterTextChanged(org.thoughtcrime.securesms.util.text.AfterTextChanged) SelectionAwareEmojiEditText(org.thoughtcrime.securesms.components.SelectionAwareEmojiEditText)

Example 2 with MultiShareArgs

use of org.thoughtcrime.securesms.sharing.MultiShareArgs in project Signal-Android by WhisperSystems.

the class ShareInterstitialActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState, boolean ready) {
    dynamicTheme.onCreate(this);
    setContentView(R.layout.share_interstitial_activity);
    MultiShareArgs args = getIntent().getParcelableExtra(ARGS);
    initializeViewModels(args);
    initializeViews(args);
    initializeObservers();
}
Also used : MultiShareArgs(org.thoughtcrime.securesms.sharing.MultiShareArgs)

Aggregations

MultiShareArgs (org.thoughtcrime.securesms.sharing.MultiShareArgs)2 Context (android.content.Context)1 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 View (android.view.View)1 NonNull (androidx.annotation.NonNull)1 Toolbar (androidx.appcompat.widget.Toolbar)1 ViewModelProviders (androidx.lifecycle.ViewModelProviders)1 DefaultItemAnimator (androidx.recyclerview.widget.DefaultItemAnimator)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 Stream (com.annimon.stream.Stream)1 CircularProgressButton (com.dd.CircularProgressButton)1 Objects (java.util.Objects)1 PassphraseRequiredActivity (org.thoughtcrime.securesms.PassphraseRequiredActivity)1 R (org.thoughtcrime.securesms.R)1 LinkPreviewView (org.thoughtcrime.securesms.components.LinkPreviewView)1 SelectionAwareEmojiEditText (org.thoughtcrime.securesms.components.SelectionAwareEmojiEditText)1 LinkPreviewRepository (org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository)1 LinkPreviewViewModel (org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel)1 GlideApp (org.thoughtcrime.securesms.mms.GlideApp)1