List of usage examples for android.view MenuInflater inflate
public void inflate(@MenuRes int menuRes, Menu menu)
From source file:study.tdcc.act.MainCalendar.java
/** * ??/*from w w w . j ava 2 s . c o m*/ * * @param Menu ?? * @return ??????true */ public boolean onCreateOptionsMenu(Menu menu) { Log.d("DEBUG", "MainCalendar onCreateOptionsMenu Start"); //MenuInflater? MenuInflater miObj = getMenuInflater(); //MenuInflater????? miObj.inflate(R.menu.calendar_menu, menu); Log.d("DEBUG", "MainCalendar onCreateOptionsMenu End"); return super.onCreateOptionsMenu(menu); }
From source file:com.aimfire.gallery.GalleryActivity.java
/** * Override Activity lifecycle method.// w ww .j a v a 2s .c o m */ @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_gallery, menu); if (mViewPager != null) { shareUpdate(mViewPager.getCurrentItem()); } /* * To show icon (instead of only text) in action bar overflow */ if (menu.getClass().getSimpleName().equals("MenuBuilder")) { try { Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE); m.setAccessible(true); m.invoke(menu, true); } catch (NoSuchMethodException e) { if (BuildConfig.DEBUG) if (VERBOSE) Log.e(TAG, "onCreateOptionsMenu", e); } catch (Exception e) { throw new RuntimeException(e); } } return super.onCreateOptionsMenu(menu); }
From source file:com.andrewshu.android.reddit.comments.CommentsListActivity.java
/** * Populates the menu.//w ww . j a v a 2 s. c o m */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.comments, menu); return true; }
From source file:com.dycody.android.idealnote.DetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_detail, menu); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.ezac.gliderlogs.FlightOverviewActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.listmenu, menu); this.menu = menu; // adjust value in menu button to value in use MenuItem MenuItem_dur = menu.findItem(R.id.action_45min); MenuItem_dur.setTitle("" + appPRE + " Min"); // adjust visibility of some menu tabs String v[] = appFLG.split(";"); //Log.d(TAG,"p1 " + isInit + " p2 "+ Boolean.parseBoolean(v[1])); menu.findItem(R.id.action_db_start)//from ww w .j a v a 2s . co m .setVisible(((isInit == true) && Boolean.parseBoolean(v[1])) ? false : true); menu.findItem(R.id.action_ezac).setVisible(Boolean.parseBoolean(v[2])); menu.findItem(R.id.action_meteo_group).setVisible(Boolean.parseBoolean(v[3])); menu.findItem(R.id.action_ntm_nld).setVisible(Boolean.parseBoolean(v[4])); menu.findItem(R.id.action_ntm_blx).setVisible(Boolean.parseBoolean(v[4])); menu.findItem(R.id.action_ogn_flarm).setVisible(Boolean.parseBoolean(v[5])); menu.findItem(R.id.action_adsb).setVisible(Boolean.parseBoolean(v[6])); menu.findItem(R.id.action_adsb_lcl).setVisible(Boolean.parseBoolean(v[7])); // adjust value in menu button to current date MenuItem MenuItem_date = menu.findItem(R.id.action_date); String s[] = ToDay.split("-"); MenuItem_date.setTitle(s[0] + " " + month_list[Integer.parseInt(s[1]) - 1]); return true; }
From source file:com.lifehackinnovations.siteaudit.FloorPlanActivity.java
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.floorplan_menu, menu); return true;/*from w w w . j a v a 2 s.co m*/ }
From source file:com.tweetlanes.android.core.view.TweetFeedFragment.java
@Override public boolean configureOptionsMenu(MenuInflater inflater, Menu menu) { if (inflater != null && mContentHandle != null && (mContentHandle.getStatusesType() == StatusesType.USER_TIMELINE || mContentHandle.getStatusesType() == StatusesType.USER_HOME_TIMELINE || mContentHandle.getStatusesType() == StatusesType.USER_LIST_TIMELINE)) { if (getBaseLaneActivity() instanceof HomeActivity) { inflater.inflate(R.menu.home_tweet_feed_action_bar, menu); } else {/*from w ww . jav a 2 s . c o m*/ inflater.inflate(R.menu.tweet_feed_action_bar, menu); } for (int i = 0; i < menu.size(); i++) { MenuItem menuItem = menu.getItem(i); if (menuItem.getItemId() == R.id.action_feed_filter) { SubMenu subMenu = menuItem.getSubMenu(); if (subMenu != null) { SocialNetConstant.Type socialNetType = getApp().getCurrentAccount().getSocialNetType(); int subMenuSize = subMenu.size(); for (int j = 0; j < subMenuSize; j++) { MenuItem subMenuItem = subMenu.getItem(j); int i1 = subMenuItem.getItemId(); if (i1 == R.id.action_replies_visibility) { subMenuItem .setTitle(getString(getBaseLaneActivity().mStatusesFilter.getShowReplies() ? R.string.action_hide_replies : R.string.action_show_replies)); } else if (i1 == R.id.action_retweets_visibility) { subMenuItem .setTitle(getString(getBaseLaneActivity().mStatusesFilter.getShowRetweets() ? socialNetType == SocialNetConstant.Type.Twitter ? R.string.action_hide_retweets : R.string.action_hide_retweets_adn : socialNetType == SocialNetConstant.Type.Twitter ? R.string.action_show_retweets : R.string.action_show_retweets_adn)); } else { } } } } } return true; } return false; }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); if (inflater != null && PrivacyService.checkClient()) { // Inflate menu inflater.inflate(R.menu.main, menu); // Searchable SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search)); if (searchView != null) { searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override/* ww w . j av a 2 s . co m*/ public boolean onQueryTextChange(String newText) { searchQuery = newText; applyFilter(); return true; } @Override public boolean onQueryTextSubmit(String query) { searchQuery = query; applyFilter(); return true; } }); searchView.setOnCloseListener(new SearchView.OnCloseListener() { @Override public boolean onClose() { searchQuery = ""; applyFilter(); return true; } }); } return true; } else return false; }
From source file:com.zen.androidhtmleditor.AHEActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mainmenu, menu); isFinalized = true;/*from w w w . ja v a 2s. c o m*/ return true; }
From source file:com.android.calendar.EventInfoFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // Show color/edit/delete buttons only in non-dialog configuration if (!mIsDialog && !mIsTabletConfig || mWindowStyle == EventInfoFragment.FULL_WINDOW_STYLE) { inflater.inflate(R.menu.event_info_title_bar, menu); mMenu = menu;//from w w w. j a v a 2 s .c o m updateMenu(); } }