Search in sources :

Example 61 with Toolbar

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();
    }
}
Also used : AccountJid(com.xabber.android.data.entity.AccountJid) View(android.view.View) Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 62 with Toolbar

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);
}
Also used : Intent(android.content.Intent) View(android.view.View) Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 63 with Toolbar

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);
}
Also used : ConferenceSelectFragment(com.xabber.android.ui.fragment.ConferenceSelectFragment) View(android.view.View) Toolbar(androidx.appcompat.widget.Toolbar) BarPainter(com.xabber.android.ui.color.BarPainter)

Example 64 with Toolbar

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();
    });
}
Also used : Intent(android.content.Intent) Toolbar(androidx.appcompat.widget.Toolbar)

Example 65 with Toolbar

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));
}
Also used : SignalStore(org.thoughtcrime.securesms.keyvalue.SignalStore) Arrays(java.util.Arrays) Bundle(android.os.Bundle) EditTextUtil(org.signal.core.util.EditTextUtil) NonNull(androidx.annotation.NonNull) AvatarPickerFragment(org.thoughtcrime.securesms.avatar.picker.AvatarPickerFragment) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder) ImageView(android.widget.ImageView) ViewUtil(org.thoughtcrime.securesms.util.ViewUtil) Drawable(android.graphics.drawable.Drawable) R(org.thoughtcrime.securesms.R) VectorDrawableCompat(androidx.vectordrawable.graphics.drawable.VectorDrawableCompat) SafeNavigation(org.thoughtcrime.securesms.util.navigation.SafeNavigation) RecipientId(org.thoughtcrime.securesms.recipients.RecipientId) Media(org.thoughtcrime.securesms.mediasend.Media) View(android.view.View) ViewModelProviders(androidx.lifecycle.ViewModelProviders) Recipient(org.thoughtcrime.securesms.recipients.Recipient) DecryptableStreamUriLoader(org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader) RecipientDisappearingMessagesActivity(org.thoughtcrime.securesms.recipients.ui.disappearingmessages.RecipientDisappearingMessagesActivity) ViewGroup(android.view.ViewGroup) Objects(java.util.Objects) StringRes(androidx.annotation.StringRes) FeatureFlags(org.thoughtcrime.securesms.util.FeatureFlags) List(java.util.List) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) Toolbar(androidx.appcompat.widget.Toolbar) ExpireTimerSettingsFragment(org.thoughtcrime.securesms.components.settings.app.privacy.expire.ExpireTimerSettingsFragment) BitmapUtil(org.thoughtcrime.securesms.util.BitmapUtil) GlideApp(org.thoughtcrime.securesms.mms.GlideApp) Context(android.content.Context) Intent(android.content.Intent) ExpirationUtil(org.thoughtcrime.securesms.util.ExpirationUtil) AvatarSelectionActivity(org.thoughtcrime.securesms.mediasend.AvatarSelectionActivity) GroupMemberListView(org.thoughtcrime.securesms.groups.ui.GroupMemberListView) Toast(android.widget.Toast) DiskCacheStrategy(com.bumptech.glide.load.engine.DiskCacheStrategy) CircularProgressButton(com.dd.CircularProgressButton) CustomTarget(com.bumptech.glide.request.target.CustomTarget) InsetDrawable(android.graphics.drawable.InsetDrawable) AvatarHelper(org.thoughtcrime.securesms.profiles.AvatarHelper) LayoutInflater(android.view.LayoutInflater) AfterTextChanged(org.thoughtcrime.securesms.util.text.AfterTextChanged) NonGv2MemberDialog(org.thoughtcrime.securesms.groups.ui.creategroup.dialogs.NonGv2MemberDialog) Bitmap(android.graphics.Bitmap) Transition(com.bumptech.glide.request.transition.Transition) LearnMoreTextView(org.thoughtcrime.securesms.util.views.LearnMoreTextView) Navigation(androidx.navigation.Navigation) LoggingFragment(org.thoughtcrime.securesms.LoggingFragment) Activity(android.app.Activity) EditText(android.widget.EditText) LearnMoreTextView(org.thoughtcrime.securesms.util.views.LearnMoreTextView) TextView(android.widget.TextView) LearnMoreTextView(org.thoughtcrime.securesms.util.views.LearnMoreTextView) InsetDrawable(android.graphics.drawable.InsetDrawable) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) GroupMemberListView(org.thoughtcrime.securesms.groups.ui.GroupMemberListView) LearnMoreTextView(org.thoughtcrime.securesms.util.views.LearnMoreTextView) AfterTextChanged(org.thoughtcrime.securesms.util.text.AfterTextChanged) GroupMemberListView(org.thoughtcrime.securesms.groups.ui.GroupMemberListView)

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