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);
}
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());
}
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);
}
}
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);
});
}
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();
}
}
Aggregations