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.android.gallery3d.ingest.IngestActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.ingest_menu_item_list_selection, menu);
    mMenuSwitcherItem = menu.findItem(R.id.ingest_switch_view);
    menu.findItem(R.id.ingest_import_items).setVisible(false);
    setSwitcherMenuState(mMenuSwitcherItem, mFullscreenPagerVisible);
    return true;//from   w  ww  .  ja v  a2  s  .  co  m
}

From source file:com.etime.ETimeActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu, menu);
    return true;//from  ww  w.j  a  v a2 s .  com
}

From source file:net.gerosyab.dailylog.activity.MainActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MyLog.d(LOG_TAG, "onCreateContextMenu() - menuInfo : " + menuInfo.toString());
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_context, menu);
}

From source file:com.foundstone.certinstaller.CertInstallerActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.layout.menu, menu);
    return true;//from w w  w  .  j a v a  2s.c o  m
}

From source file:biz.incomsystems.fwknop2.ConfigDetailFragment.java

public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // Inflate the menu; this adds items to the action bar if it is present.
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.detail_menu, menu);

}

From source file:com.example.android.naradaonline.DatagramFragment.java

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

From source file:com.adguard.android.contentblocker.MainActivity.java

@SuppressWarnings("ConstantConditions")
@Override/*from   www  .j  ava  2s. c  om*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // As we're using a Toolbar, we should retrieve it and set it to be our ActionBar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("");
    setSupportActionBar(toolbar);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerList = (ListView) findViewById(R.id.drawer_list);
    leftDrawer = (LinearLayout) findViewById(R.id.left_drawer);

    // Set the adapter for the list view
    DrawerArrayAdapter<DrawerListItem> adapter = new DrawerArrayAdapter<>(this, R.layout.drawer_list_item,
            R.id.text_view, R.id.image_view, getDrawerItems());
    drawerList.setAdapter(adapter);
    // Set the list's click listener
    drawerList.setOnItemClickListener(new DrawerItemClickListener());
    drawerLayout.setDrawerListener(this);
    drawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));

    drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.openned_drawer_title,
            R.string.closed_drawer_title);
    //drawerToggle.setHomeAsUpIndicator(R.drawable.ic_drawer);

    findViewById(R.id.go_to_filters).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            openFiltersSettings();
        }
    });

    final View menuImageView = findViewById(R.id.menuImageView);
    if (menuImageView != null) {
        menuImageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // inflate menu
                PopupMenu popup = new PopupMenu(menuImageView.getContext(), menuImageView);
                MenuInflater inflater = popup.getMenuInflater();
                inflater.inflate(R.menu.filters_popup_menu, popup.getMenu());
                popup.setOnMenuItemClickListener(new FiltersMenuItemClickListener());
                popup.show();
            }
        });
    }

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }

    PreferencesService preferencesService = ServiceLocator.getInstance(getApplicationContext())
            .getPreferencesService();
    if (!preferencesService.isOnboardingShown()) {
        startActivity(new Intent(this, OnboardingActivity.class));
    }

    ServiceLocator.getInstance(getApplicationContext()).getFilterService().scheduleFiltersUpdate();
}

From source file:com.app.uafeed.activity.EditFeedActivity.java

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

    return super.onCreateOptionsMenu(menu);
}

From source file:ch.bfh.instacircle.NetworkActiveActivity.java

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

    // only display the NFC action if NFC is available
    if (!this.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) {
        menu.removeItem(R.id.write_nfc_tag);
    }/*from  w  ww .j  ava  2  s  .c o m*/
    return true;
}

From source file:com.thalmic.android.sample.helloworld.HelloWorldActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);
    return true;/*from  ww w .j a  va 2s. c  o m*/
}