Example usage for android.view MenuInflater MenuInflater

List of usage examples for android.view MenuInflater MenuInflater

Introduction

In this page you can find the example usage for android.view MenuInflater MenuInflater.

Prototype

public MenuInflater(Context context) 

Source Link

Document

Constructs a menu inflater.

Usage

From source file:dong.lan.tuyi.activity.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = new MenuInflater(this);
    inflater.inflate(R.menu.toolbar_menu, menu);
    return super.onCreateOptionsMenu(menu);
}

From source file:com.autburst.picture.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    new MenuInflater(this).inflate(R.menu.mainmenu, menu);
    return super.onCreateOptionsMenu(menu);
}

From source file:org.mariotaku.twidere.fragment.MessagesConversationFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (menuInfo == null)
        return;//w w  w.  j  av  a  2  s .c  o  m
    final MenuInflater inflater = new MenuInflater(getContext());
    final ExtendedRecyclerView.ContextMenuInfo contextMenuInfo = (ExtendedRecyclerView.ContextMenuInfo) menuInfo;
    ParcelableDirectMessage message = mAdapter.getDirectMessage(contextMenuInfo.getPosition());
    menu.setHeaderTitle(message.text_unescaped);
    inflater.inflate(R.menu.action_direct_message, menu);
}

From source file:com.gsma.rcs.ri.messaging.OneToOneTalkView.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = new MenuInflater(getApplicationContext());
    inflater.inflate(R.menu.menu_1to1_talk, menu);
    return true;/* ww  w.java2  s . co m*/
}

From source file:com.almarsoft.GroundhogReader.MessageListActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    new MenuInflater(getApplication()).inflate(R.menu.messagelistmenu, menu);

    return (super.onCreateOptionsMenu(menu));
}

From source file:org.mariotaku.twidere.fragment.AbsActivitiesFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (!getUserVisibleHint() || menuInfo == null)
        return;//  ww  w. j a v a2  s.c o m
    final ParcelableActivitiesAdapter adapter = getAdapter();
    final MenuInflater inflater = new MenuInflater(getContext());
    final ExtendedRecyclerView.ContextMenuInfo contextMenuInfo = (ExtendedRecyclerView.ContextMenuInfo) menuInfo;
    final int position = contextMenuInfo.getPosition();
    switch (adapter.getItemViewType(position)) {
    case ParcelableActivitiesAdapter.ITEM_VIEW_TYPE_STATUS: {
        final ParcelableStatus status = getActivityStatus(position);
        if (status == null)
            return;
        inflater.inflate(R.menu.action_status, menu);
        MenuUtils.setupForStatus(getContext(), mPreferences, menu, status, mTwitterWrapper);
        break;
    }
    }
}

From source file:org.mariotaku.twidere.fragment.AbsStatusesFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    if (!getUserVisibleHint() || menuInfo == null)
        return;/*from   ww w.  j  a v a  2  s  .c o m*/
    final ParcelableStatusesAdapter adapter = getAdapter();
    final MenuInflater inflater = new MenuInflater(getContext());
    final ExtendedRecyclerView.ContextMenuInfo contextMenuInfo = (ExtendedRecyclerView.ContextMenuInfo) menuInfo;
    final ParcelableStatus status = adapter.getStatus(contextMenuInfo.getPosition());
    inflater.inflate(R.menu.action_status, menu);
    MenuUtils.setupForStatus(getContext(), mPreferences, menu, status, mTwitterWrapper);
}

From source file:org.numixproject.hermes.activity.ConversationActivity.java

/**
 * On options menu requested//from  www.  j  a  v  a 2  s . com
 */
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.clear();

    // Check the menu to display (Server or Conversation)
    if (conversationLayout.getVisibility() == LinearLayout.INVISIBLE) {
        if (server.getStatus() == Status.CONNECTED) {
            // inflate Server options from xml
            MenuInflater inflater = new MenuInflater(this);
            inflater.inflate(R.menu.room_activity, menu);
        } else {
            // inflate Server options from xml
            MenuInflater inflater = new MenuInflater(this);
            inflater.inflate(R.menu.room_activity_disconnected, menu);
        }
    } else {
        // inflate Conversation options from xml
        MenuInflater inflater = new MenuInflater(this);
        inflater.inflate(R.menu.conversations, menu);
    }

    return super.onPrepareOptionsMenu(menu);
}

From source file:com.gsma.rcs.ri.messaging.GroupTalkView.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = new MenuInflater(getApplicationContext());
    inflater.inflate(R.menu.menu_group_chat, menu);
    return true;//from  w  w  w .j  a  v  a2  s. co m
}