use of androidx.appcompat.widget.Toolbar in project xabber-android by redsolution.
the class AccountHistorySettingsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_history_settings);
AccountJid account = getAccount(getIntent());
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setTitle(R.string.account_chat_history);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
BarPainter barPainter = new BarPainter(this, toolbar);
barPainter.updateWithAccountName(account);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction().add(R.id.account_history_settings_fragment, AccountHistorySettingsFragment.newInstance(account)).commit();
}
}
use of androidx.appcompat.widget.Toolbar in project xabber-android by redsolution.
the class ConferenceAddActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isFinishing()) {
return;
}
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp);
toolbar.inflateMenu(R.menu.toolbar_add_conference);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbar.setOnMenuItemClickListener(this);
BarPainter barPainter = new BarPainter(this, toolbar);
barPainter.setDefaultColor();
Intent intent = getIntent();
if (savedInstanceState != null) {
account = savedInstanceState.getParcelable(SAVED_ACCOUNT);
room = (EntityBareJid) savedInstanceState.getSerializable(SAVED_ROOM);
} else {
account = getAccount(intent);
room = getUser(intent).getJid().asEntityBareJidIfPossible();
}
barPainter.updateWithAccountName(account);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction().add(R.id.fragment_container, ConferenceAddFragment.newInstance(account, room)).commit();
}
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
use of androidx.appcompat.widget.Toolbar in project xabber-android by redsolution.
the class ConferenceSelectActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NavUtils.navigateUpFromSameTask(ConferenceSelectActivity.this);
}
});
toolbar.setTitle(getString(R.string.muc_choose_conference));
barPainter = new BarPainter(this, toolbar);
barPainter.setDefaultColor();
if (savedInstanceState == null) {
getFragmentManager().beginTransaction().add(R.id.fragment_container, new ConferenceSelectFragment()).commit();
}
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
use of androidx.appcompat.widget.Toolbar in project Signal-Android by WhisperSystems.
the class ContactNameEditActivity method initializeToolbar.
private void initializeToolbar() {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle("");
toolbar.setNavigationOnClickListener(v -> {
Intent resultIntent = new Intent();
resultIntent.putExtra(KEY_NAME, viewModel.getName());
resultIntent.putExtra(KEY_CONTACT_INDEX, getIntent().getIntExtra(KEY_CONTACT_INDEX, -1));
setResult(RESULT_OK, resultIntent);
finish();
});
}
use of androidx.appcompat.widget.Toolbar in project Signal-Android by WhisperSystems.
the class AddGroupDetailsFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
create = view.findViewById(R.id.create);
name = view.findViewById(R.id.name);
toolbar = view.findViewById(R.id.toolbar);
disappearingMessagesRow = view.findViewById(R.id.group_disappearing_messages_row);
setCreateEnabled(false, false);
GroupMemberListView members = view.findViewById(R.id.member_list);
ImageView avatar = view.findViewById(R.id.group_avatar);
View mmsWarning = view.findViewById(R.id.mms_warning);
LearnMoreTextView gv2Warning = view.findViewById(R.id.gv2_warning);
View addLater = view.findViewById(R.id.add_later);
TextView disappearingMessageValue = view.findViewById(R.id.group_disappearing_messages_value);
members.initializeAdapter(getViewLifecycleOwner());
avatarPlaceholder = VectorDrawableCompat.create(getResources(), R.drawable.ic_camera_outline_32_ultramarine, requireActivity().getTheme());
if (savedInstanceState == null) {
avatar.setImageDrawable(new InsetDrawable(avatarPlaceholder, ViewUtil.dpToPx(AVATAR_PLACEHOLDER_INSET_DP)));
}
initializeViewModel();
avatar.setOnClickListener(v -> showAvatarPicker());
members.setRecipientClickListener(this::handleRecipientClick);
EditTextUtil.addGraphemeClusterLimitFilter(name, FeatureFlags.getMaxGroupNameGraphemeLength());
name.addTextChangedListener(new AfterTextChanged(editable -> viewModel.setName(editable.toString())));
toolbar.setNavigationOnClickListener(unused -> callback.onNavigationButtonPressed());
create.setOnClickListener(v -> handleCreateClicked());
viewModel.getMembers().observe(getViewLifecycleOwner(), list -> {
addLater.setVisibility(list.isEmpty() ? View.VISIBLE : View.GONE);
members.setMembers(list);
});
viewModel.getCanSubmitForm().observe(getViewLifecycleOwner(), isFormValid -> setCreateEnabled(isFormValid, true));
viewModel.getIsMms().observe(getViewLifecycleOwner(), isMms -> {
disappearingMessagesRow.setVisibility(isMms ? View.GONE : View.VISIBLE);
mmsWarning.setVisibility(isMms ? View.VISIBLE : View.GONE);
name.setHint(isMms ? R.string.AddGroupDetailsFragment__group_name_optional : R.string.AddGroupDetailsFragment__group_name_required);
toolbar.setTitle(isMms ? R.string.AddGroupDetailsFragment__create_group : R.string.AddGroupDetailsFragment__name_this_group);
});
viewModel.getNonGv2CapableMembers().observe(getViewLifecycleOwner(), nonGv2CapableMembers -> {
gv2Warning.setVisibility(nonGv2CapableMembers.isEmpty() ? View.GONE : View.VISIBLE);
gv2Warning.setText(requireContext().getResources().getQuantityString(R.plurals.AddGroupDetailsFragment__d_members_do_not_support_new_groups_so_this_group_cannot_be_created, nonGv2CapableMembers.size(), nonGv2CapableMembers.size()));
gv2Warning.setLearnMoreVisible(true);
gv2Warning.setOnLinkClickListener(v -> NonGv2MemberDialog.showNonGv2Members(requireContext(), getViewLifecycleOwner(), nonGv2CapableMembers));
});
viewModel.getAvatar().observe(getViewLifecycleOwner(), avatarBytes -> {
if (avatarBytes == null) {
avatar.setImageDrawable(new InsetDrawable(avatarPlaceholder, ViewUtil.dpToPx(AVATAR_PLACEHOLDER_INSET_DP)));
} else {
GlideApp.with(this).load(avatarBytes).circleCrop().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(avatar);
}
});
viewModel.getDisappearingMessagesTimer().observe(getViewLifecycleOwner(), timer -> disappearingMessageValue.setText(ExpirationUtil.getExpirationDisplayValue(requireContext(), timer)));
disappearingMessagesRow.setOnClickListener(v -> {
startActivityForResult(RecipientDisappearingMessagesActivity.forCreateGroup(requireContext(), viewModel.getDisappearingMessagesTimer().getValue()), REQUEST_DISAPPEARING_TIMER);
});
name.requestFocus();
getParentFragmentManager().setFragmentResultListener(AvatarPickerFragment.REQUEST_KEY_SELECT_AVATAR, getViewLifecycleOwner(), (key, bundle) -> handleMediaResult(bundle));
}
Aggregations