Example usage for android.view MenuInflater inflate

List of usage examples for android.view MenuInflater inflate

Introduction

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

Prototype

public void inflate(@MenuRes int menuRes, Menu menu) 

Source Link

Document

Inflate a menu hierarchy from the specified XML resource.

Usage

From source file:com.mycompany.myfirstindoorsapp.PagedActivity.java

public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.options_menu, menu);

    return true;//  w  ww .ja v  a2  s. c o m
}

From source file:com.code.android.vibevault.ShowDetailsScreen.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.help_recentshows_nowplaying_email_options, menu);
    return true;//from  www .  jav a  2s . c om
}

From source file:com.andrada.sitracker.ui.fragment.DirectoryChooserFragment.java

@Override
public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater inflater) {
    inflater.inflate(R.menu.directory_chooser, menu);

    final MenuItem menuItem = menu.findItem(R.id.new_folder_item);

    if (menuItem == null) {
        return;//from  www .ja  v a 2  s  .  c o  m
    }

    menuItem.setVisible(mInitialDirectory != null && isValidFile(new File(mInitialDirectory))
            && mNewDirectoryName != null && mIsDirectoryChooser);
}

From source file:com.activiti.android.ui.fragments.task.form.TaskFormFoundationFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (getVersionNumber() >= ActivitiVersionNumber.VERSION_1_2_2 && !isEnded) {
        if (!DisplayUtils.hasCentralPane(getActivity())) {
            menu.clear();//from  w  w  w. j  a  v a 2  s . c o m
            inflater.inflate(R.menu.task_form, menu);
        } else {
            getToolbar().getMenu().clear();
            getToolbar().inflateMenu(R.menu.task_form);
            // Set an OnMenuItemClickListener to handle menu item clicks
            getToolbar().setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    return onOptionsItemSelected(item);
                }
            });

        }
    }
}

From source file:sjizl.com.FileUploadTest.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.photo_menu_list, menu);

}

From source file:com.android.browser.BookmarksPageCallbacks.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    BookmarkContextMenuInfo info = (BookmarkContextMenuInfo) menuInfo;
    BrowserBookmarksAdapter adapter = getChildAdapter(info.groupPosition);
    Cursor cursor = adapter.getItem(info.childPosition);
    if (!canEdit(cursor)) {
        return;//from  ww w  . j a va2s .c o m
    }
    boolean isFolder = cursor.getInt(BookmarksLoader.COLUMN_INDEX_IS_FOLDER) != 0;

    final Activity activity = getActivity();
    MenuInflater inflater = activity.getMenuInflater();
    inflater.inflate(R.menu.bookmarkscontext, menu);
    if (isFolder) {
        menu.setGroupVisible(R.id.FOLDER_CONTEXT_MENU, true);
    } else {
        menu.setGroupVisible(R.id.BOOKMARK_CONTEXT_MENU, true);
        if (mDisableNewWindow) {
            menu.findItem(R.id.new_window_context_menu_id).setVisible(false);
        }
    }
    BookmarkItem header = new BookmarkItem(activity);
    header.setEnableScrolling(true);
    populateBookmarkItem(cursor, header, isFolder);
    menu.setHeaderView(header);

    int count = menu.size();
    for (int i = 0; i < count; i++) {
        menu.getItem(i).setOnMenuItemClickListener(mContextItemClickListener);
    }
}

From source file:co.nerdart.ourss.fragment.FeedsListFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (mListView.isDragNDropEnabled()) {
        inflater.inflate(R.menu.feed_overview_sorting, menu);
    } else {//from  ww  w  .  ja  v a 2 s.c o  m
        inflater.inflate(R.menu.feed_overview, menu);
    }

    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.baohume.browser.BookmarksPageCallbacks.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    BookmarkExpandableView.BookmarkContextMenuInfo info = (BookmarkExpandableView.BookmarkContextMenuInfo) menuInfo;
    BrowserBookmarksAdapter adapter = getChildAdapter(info.groupPosition);
    Cursor cursor = adapter.getItem(info.childPosition);
    if (!canEdit(cursor)) {
        return;//from w  w  w . j ava  2s  .c o  m
    }
    boolean isFolder = cursor.getInt(BookmarksLoader.COLUMN_INDEX_IS_FOLDER) != 0;

    final Activity activity = getActivity();
    MenuInflater inflater = activity.getMenuInflater();
    inflater.inflate(R.menu.bookmarkscontext, menu);
    if (isFolder) {
        menu.setGroupVisible(R.id.FOLDER_CONTEXT_MENU, true);
    } else {
        menu.setGroupVisible(R.id.BOOKMARK_CONTEXT_MENU, true);
        if (mDisableNewWindow) {
            menu.findItem(R.id.new_window_context_menu_id).setVisible(false);
        }
    }
    BookmarkItem header = new BookmarkItem(activity);
    header.setEnableScrolling(true);
    populateBookmarkItem(cursor, header, isFolder);
    menu.setHeaderView(header);

    int count = menu.size();
    for (int i = 0; i < count; i++) {
        menu.getItem(i).setOnMenuItemClickListener(mContextItemClickListener);
    }
}

From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java

@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
    inflater.inflate(R.menu.view_event, menu);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:co.carlosjimenez.android.currencyalerts.app.MainActivityFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (getActivity() instanceof MainActivity) {
        // Inflate the menu; this adds items to the action bar if it is present.
        inflater.inflate(R.menu.menu_main, menu);
    }//from  www. ja v  a2s.  c o m
}