List of usage examples for android.view MenuInflater inflate
public void inflate(@MenuRes int menuRes, Menu menu)
From source file:com.cm.android.beercellar.ui.ImageDetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.image_detail_menu, menu); }
From source file:com.krayzk9s.imgurholo.ui.AlbumsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { ImgurHoloActivity activity = (ImgurHoloActivity) getActivity(); if (activity.getApiCall().settings.getString("theme", MainActivity.HOLO_LIGHT) .equals(MainActivity.HOLO_LIGHT)) inflater.inflate(R.menu.main, menu); else//from ww w . j a v a 2s .co m inflater.inflate(R.menu.main_dark, menu); if (username.equals("me")) menu.findItem(R.id.action_new).setVisible(true); menu.findItem(R.id.action_upload).setVisible(false); menu.findItem(R.id.action_refresh).setVisible(true); }
From source file:io.github.protino.codewatch.ui.LeaderboardFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.leaders_menu, menu); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.example.android.imaginarium.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater mif = getMenuInflater(); mif.inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); }
From source file:com.akop.bach.fragment.xboxlive.MessagesFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.xbl_message_list, menu); }
From source file:ca.farrelltonsolar.classic.NavigationDrawerFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // If the drawer is open, show the global app actions in the action bar. See also // showGlobalContextActionBar, which controls the top-left area of the action bar. if (mDrawerLayout != null && isDrawerOpen()) { inflater.inflate(R.menu.navigation_drawer_menu, menu); showGlobalContextActionBar();// w ww . ja v a 2 s . c o m } super.onCreateOptionsMenu(menu, inflater); }
From source file:com.adrguides.ReadGuideFragment.java
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.read_guide, menu); menu.findItem(R.id.action_playpause).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override// w w w.j a v a 2 s . co m public boolean onMenuItemClick(MenuItem menuItem) { ttsfragment.playstartpause(); return true; } }); menu.findItem(R.id.action_next).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ttsfragment.gotoNext(); return true; } }); menu.findItem(R.id.action_previous).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { ttsfragment.gotoPrevious(); return true; } }); menu.findItem(R.id.action_list).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { new ListDialogFragment().show(getFragmentManager(), ListDialogFragment.TAG); return true; } }); menu.findItem(R.id.action_viewguide).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { // Intent internetIntent = new Intent(Intent.ACTION_VIEW); // internetIntent.setData(Uri.parse(ttsfragment.getGuide().getAddress())); // startActivity(internetIntent); Intent intent = new Intent(getActivity(), WebViewActivity.class); intent.putExtra(WebViewActivity.EXTRA_URL, ttsfragment.getGuide().getAddress()); intent.putExtra(WebViewActivity.EXTRA_TITLE, ttsfragment.getGuide().getTitle()); startActivity(intent); return true; } }); menu.findItem(R.id.action_bookmark).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { new SaveGuideTask(ReadGuideFragment.this.getActivity().getApplicationContext()) .execute(ttsfragment.getGuide()); return true; } }); searchview = new SearchViewGuides(getActivity(), menu.findItem(R.id.menu_search)); }
From source file:com.streaming.sweetplayer.PlayerActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.player_options_menu, menu); inflater.inflate(R.menu.share_menu, menu); MenuItem shareItem = menu.findItem(R.id.item_share); mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem); mShareActionProvider.setShareIntent(getDefaultIntent()); //mShareActionProvider.setShareHistoryFileName(null); MenuItem viewLyricsMenuItem = menu.findItem(R.id.item_view_lyrics); if (viewLyricsMenuItem != null) { viewLyricsMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { if (PlayerService.checkSongsList()) { new GetSongDetailTask().execute(); }//from w w w .j a v a2 s . c o m return true; } }); } mAddMenuItem = menu.findItem(R.id.item_add_to_playlist); if (mDataBase.isOnPlayList(sSongId)) { mAddMenuItem.setVisible(false); } else { mAddMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { addToPlaylist(); return true; } }); } return super.onCreateOptionsMenu(menu); }
From source file:com.adamas.client.android.ui.ConnectorsFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.menu_connector, menu); }
From source file:br.com.thinkti.android.filechooserfrag.fragFileChooser.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; if (info.position > 0) { MenuInflater inflater = _main.getMenuInflater(); inflater.inflate(R.menu.context, menu); if (_copiedFile == null && _cutFile == null) { menu.findItem(R.id.mnuPaste).setEnabled(false); } else {/*from w w w. j a v a 2 s. co m*/ menu.findItem(R.id.mnuPaste).setEnabled(true); } } }