Search in sources :

Example 61 with MenuInflater

use of android.view.MenuInflater in project Signal-Android by WhisperSystems.

the class ConversationActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuInflater inflater = this.getMenuInflater();
    menu.clear();
    if (isSecureText) {
        if (recipients.getExpireMessages() > 0) {
            inflater.inflate(R.menu.conversation_expiring_on, menu);
            final MenuItem item = menu.findItem(R.id.menu_expiring_messages);
            final View actionView = MenuItemCompat.getActionView(item);
            final TextView badgeView = (TextView) actionView.findViewById(R.id.expiration_badge);
            badgeView.setText(ExpirationUtil.getExpirationAbbreviatedDisplayValue(this, recipients.getExpireMessages()));
            actionView.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    onOptionsItemSelected(item);
                }
            });
        } else {
            inflater.inflate(R.menu.conversation_expiring_off, menu);
        }
    }
    if (isSingleConversation()) {
        if (isSecureText)
            inflater.inflate(R.menu.conversation_callable_secure, menu);
        else
            inflater.inflate(R.menu.conversation_callable_insecure, menu);
    } else if (isGroupConversation()) {
        inflater.inflate(R.menu.conversation_group_options, menu);
        if (!isPushGroupConversation()) {
            inflater.inflate(R.menu.conversation_mms_group_options, menu);
            if (distributionType == ThreadDatabase.DistributionTypes.BROADCAST) {
                menu.findItem(R.id.menu_distribution_broadcast).setChecked(true);
            } else {
                menu.findItem(R.id.menu_distribution_conversation).setChecked(true);
            }
        } else if (isActiveGroup()) {
            inflater.inflate(R.menu.conversation_push_group_options, menu);
        }
    }
    inflater.inflate(R.menu.conversation, menu);
    if (isSingleConversation() && isSecureText) {
        inflater.inflate(R.menu.conversation_secure, menu);
    } else if (isSingleConversation()) {
        inflater.inflate(R.menu.conversation_insecure, menu);
    }
    if (recipients != null && recipients.isMuted())
        inflater.inflate(R.menu.conversation_muted, menu);
    else
        inflater.inflate(R.menu.conversation_unmuted, menu);
    if (isSingleConversation() && getRecipients().getPrimaryRecipient().getContactUri() == null) {
        inflater.inflate(R.menu.conversation_add_to_contacts, menu);
    }
    super.onPrepareOptionsMenu(menu);
    return true;
}
Also used : MenuInflater(android.view.MenuInflater) OnClickListener(android.view.View.OnClickListener) MenuItem(android.view.MenuItem) TextView(android.widget.TextView) ReminderView(org.thoughtcrime.securesms.components.reminder.ReminderView) View(android.view.View) TextView(android.widget.TextView)

Example 62 with MenuInflater

use of android.view.MenuInflater in project Signal-Android by WhisperSystems.

the class ConversationListFragment method onCreateActionMode.

@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    MenuInflater inflater = getActivity().getMenuInflater();
    if (archive)
        inflater.inflate(R.menu.conversation_list_batch_unarchive, menu);
    else
        inflater.inflate(R.menu.conversation_list_batch_archive, menu);
    inflater.inflate(R.menu.conversation_list_batch, menu);
    mode.setTitle(R.string.conversation_fragment_cab__batch_selection_mode);
    mode.setSubtitle(getString(R.string.conversation_fragment_cab__batch_selection_amount, 1));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar));
    }
    return true;
}
Also used : MenuInflater(android.view.MenuInflater)

Example 63 with MenuInflater

use of android.view.MenuInflater in project Signal-Android by WhisperSystems.

the class MediaOverviewActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    menu.clear();
    if (gridView.getAdapter() != null && gridView.getAdapter().getItemCount() > 0) {
        MenuInflater inflater = this.getMenuInflater();
        inflater.inflate(R.menu.media_overview, menu);
    }
    return true;
}
Also used : MenuInflater(android.view.MenuInflater)

Example 64 with MenuInflater

use of android.view.MenuInflater in project Signal-Android by WhisperSystems.

the class ShareActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuInflater inflater = this.getMenuInflater();
    menu.clear();
    inflater.inflate(R.menu.share, menu);
    super.onPrepareOptionsMenu(menu);
    return true;
}
Also used : MenuInflater(android.view.MenuInflater)

Example 65 with MenuInflater

use of android.view.MenuInflater in project Signal-Android by WhisperSystems.

the class VerifyIdentityActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    menu.clear();
    MenuInflater inflater = this.getMenuInflater();
    inflater.inflate(R.menu.verify_identity, menu);
    return true;
}
Also used : MenuInflater(android.view.MenuInflater)

Aggregations

MenuInflater (android.view.MenuInflater)304 MenuItem (android.view.MenuItem)32 View (android.view.View)16 Intent (android.content.Intent)12 AdapterView (android.widget.AdapterView)12 SearchView (android.support.v7.widget.SearchView)11 PopupMenu (android.widget.PopupMenu)10 TextView (android.widget.TextView)10 Menu (android.view.Menu)9 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)9 ListView (android.widget.ListView)8 SearchManager (android.app.SearchManager)6 Point (android.graphics.Point)5 AdapterContextMenuInfo (android.widget.AdapterView.AdapterContextMenuInfo)5 ImageView (android.widget.ImageView)5 MenuBuilder (com.android.internal.view.menu.MenuBuilder)5 ActionBar (android.app.ActionBar)4 Cursor (android.database.Cursor)4 MenuBuilder (android.support.v7.view.menu.MenuBuilder)4 SpannableString (android.text.SpannableString)4