Search in sources :

Example 41 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Signal-Android by WhisperSystems.

the class GroupLinkShareQrDialogFragment method initializeViews.

private void initializeViews(@NonNull View view) {
    Toolbar toolbar = view.findViewById(R.id.group_link_share_qr_toolbar);
    qrImageView = view.findViewById(R.id.group_link_share_qr_image);
    shareCodeButton = view.findViewById(R.id.group_link_share_code_button);
    toolbar.setNavigationOnClickListener(v -> dismissAllowingStateLoss());
    viewModel.getQrUrl().observe(getViewLifecycleOwner(), this::presentUrl);
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar)

Example 42 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Signal-Android by WhisperSystems.

the class SearchToolbar method initialize.

private void initialize() {
    inflate(getContext(), R.layout.search_toolbar, this);
    setOrientation(VERTICAL);
    Toolbar toolbar = findViewById(R.id.toolbar);
    Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.ic_arrow_left_24);
    toolbar.setNavigationIcon(drawable);
    toolbar.setCollapseIcon(drawable);
    toolbar.inflateMenu(R.menu.conversation_list_search);
    this.searchItem = toolbar.getMenu().findItem(R.id.action_filter_search);
    SearchView searchView = (SearchView) searchItem.getActionView();
    EditText searchText = searchView.findViewById(R.id.search_src_text);
    searchView.setSubmitButtonEnabled(false);
    if (searchText != null)
        searchText.setHint(R.string.SearchToolbar_search);
    else
        searchView.setQueryHint(getResources().getString(R.string.SearchToolbar_search));
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            if (listener != null)
                listener.onSearchTextChange(query);
            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return onQueryTextSubmit(newText);
        }
    });
    searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {

        @Override
        public boolean onMenuItemActionExpand(MenuItem item) {
            return true;
        }

        @Override
        public boolean onMenuItemActionCollapse(MenuItem item) {
            hide();
            return true;
        }
    });
    toolbar.setNavigationOnClickListener(v -> hide());
}
Also used : EditText(android.widget.EditText) SearchView(androidx.appcompat.widget.SearchView) Drawable(android.graphics.drawable.Drawable) MenuItem(android.view.MenuItem) Toolbar(androidx.appcompat.widget.Toolbar)

Example 43 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Signal-Android by WhisperSystems.

the class ShareActivity method initializeToolbar.

private void initializeToolbar() {
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
Also used : ActionBar(androidx.appcompat.app.ActionBar) SearchToolbar(org.thoughtcrime.securesms.components.SearchToolbar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 44 with Toolbar

use of androidx.appcompat.widget.Toolbar 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 45 with Toolbar

use of androidx.appcompat.widget.Toolbar in project xabber-android by redsolution.

the class ConnectionSettings method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing())
        return;
    setContentView(R.layout.activity_with_toolbar_and_container);
    String title = PreferenceSummaryHelperActivity.getPreferenceTitle(getString(R.string.preference_connection));
    Toolbar toolbar = ToolbarHelper.setUpDefaultToolbar(this, title);
    BarPainter barPainter = new BarPainter(this, toolbar);
    barPainter.setDefaultColor();
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.fragment_container, new ConnectionSettingsFragment()).commit();
    }
}
Also used : Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Aggregations

Toolbar (androidx.appcompat.widget.Toolbar)284 View (android.view.View)116 TextView (android.widget.TextView)58 RecyclerView (androidx.recyclerview.widget.RecyclerView)44 Bundle (android.os.Bundle)43 Intent (android.content.Intent)39 NonNull (androidx.annotation.NonNull)36 Fragment (androidx.fragment.app.Fragment)33 ActionBar (androidx.appcompat.app.ActionBar)29 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)29 Nullable (androidx.annotation.Nullable)28 BarPainter (com.xabber.android.ui.color.BarPainter)26 R (org.thoughtcrime.securesms.R)26 Context (android.content.Context)25 ViewGroup (android.view.ViewGroup)25 EditText (android.widget.EditText)23 MenuItem (android.view.MenuItem)21 ImageView (android.widget.ImageView)20 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)20 Navigation (androidx.navigation.Navigation)20