android.view.MenuInflater Java Examples
The following examples show how to use
android.view.MenuInflater.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserDictionarySettings.java From Android-Keyboard with Apache License 2.0 | 6 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (!UserDictionarySettings.IS_SHORTCUT_API_SUPPORTED) { final Locale systemLocale = getResources().getConfiguration().locale; if (!TextUtils.isEmpty(mLocale) && !mLocale.equals(systemLocale.toString())) { // Hide the add button for ICS because it doesn't support specifying a locale // for an entry. This new "locale"-aware API has been added in conjunction // with the shortcut API. return; } } MenuItem actionItem = menu.add(0, OPTIONS_MENU_ADD, 0, R.string.user_dict_settings_add_menu_title) .setIcon(R.drawable.ic_menu_add); actionItem.setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); }
Example #2
Source File: UserDictionarySettings.java From openboard with GNU General Public License v3.0 | 6 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (!UserDictionarySettings.IS_SHORTCUT_API_SUPPORTED) { final Locale systemLocale = getResources().getConfiguration().locale; if (!TextUtils.isEmpty(mLocale) && !mLocale.equals(systemLocale.toString())) { // Hide the add button for ICS because it doesn't support specifying a locale // for an entry. This new "locale"-aware API has been added in conjunction // with the shortcut API. return; } } MenuItem actionItem = menu.add(0, OPTIONS_MENU_ADD, 0, R.string.user_dict_settings_add_menu_title) .setIcon(R.drawable.ic_menu_add); actionItem.setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); }
Example #3
Source File: DictionarySettingsFragment.java From Android-Keyboard with Apache License 2.0 | 6 votes |
@Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void... params) { return MetadataDbHelper.getMetadataUriAsString(getActivity(), mClientId); } @Override protected void onPostExecute(String metadataUri) { // We only add the "Refresh" button if we have a non-empty URL to refresh from. If // the URL is empty, of course we can't refresh so it makes no sense to display // this. if (!TextUtils.isEmpty(metadataUri)) { if (mUpdateNowMenu == null) { mUpdateNowMenu = menu.add(Menu.NONE, MENU_UPDATE_NOW, 0, R.string.check_for_updates_now); mUpdateNowMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } refreshNetworkState(); } } }.execute(); }
Example #4
Source File: DownloadDetailsActivity.java From EdXposedManager with GNU General Public License v3.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_download_details, menu); boolean updateIgnorePreference = XposedApp.getPreferences().getBoolean("ignore_updates", false); if (updateIgnorePreference) { SharedPreferences prefs = getSharedPreferences("update_ignored", Context.MODE_PRIVATE); boolean ignored = prefs.getBoolean(mModule.packageName, false); menu.findItem(R.id.ignoreUpdate).setChecked(ignored); } else { menu.removeItem(R.id.ignoreUpdate); } mItemBookmark = menu.findItem(R.id.menu_bookmark); setupBookmark(false); return true; }
Example #5
Source File: ConversationListFragment.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(getActionModeMenuRes(), menu); inflater.inflate(R.menu.conversation_list_batch, menu); mode.setTitle("1"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar)); } if (Build.VERSION.SDK_INT >= 23) { int current = getActivity().getWindow().getDecorView().getSystemUiVisibility(); getActivity().getWindow().getDecorView().setSystemUiVisibility(current & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } return true; }
Example #6
Source File: DetailChannelActivity.java From TDTChannels-APP with MIT License | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_detail_channel, menu); boolean isItemFavorite; if (typeOfStream.equals(TYPE_TV)) { isItemFavorite = SourcesManagement.isTVChannelFavorite(channel.getName()); } else { isItemFavorite = SourcesManagement.isRadioChannelFavorite(channel.getName()); } if (isItemFavorite) { menu.getItem(0).setIcon(R.drawable.heart); } else { menu.getItem(0).setIcon(R.drawable.heart_outline); } return true; }
Example #7
Source File: DownloadHistoryPhotoFragment.java From Instagram-Profile-Downloader with MIT License | 5 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // Inflate a menu resource providing context menu items MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.menu_delete, menu); return true; }
Example #8
Source File: DownloadHistoryActivity.java From Instagram-Profile-Downloader with MIT License | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { this.menu = menu; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_download_history, menu); return true; }
Example #9
Source File: UserDictionaryAddWordFragment.java From Android-Keyboard with Apache License 2.0 | 5 votes |
@Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { final MenuItem actionItemAdd = menu.add(0, OPTIONS_MENU_ADD, 0, R.string.user_dict_settings_add_menu_title).setIcon(R.drawable.ic_menu_add); actionItemAdd.setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); final MenuItem actionItemDelete = menu.add(0, OPTIONS_MENU_DELETE, 0, R.string.user_dict_settings_delete).setIcon(android.R.drawable.ic_menu_delete); actionItemDelete.setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); }
Example #10
Source File: ConversationListFragment.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@Override public void onPrepareOptionsMenu(Menu menu) { MenuInflater inflater = requireActivity().getMenuInflater(); menu.clear(); inflater.inflate(R.menu.text_secure_normal, menu); menu.findItem(R.id.menu_insights).setVisible(TextSecurePreferences.isSmsEnabled(requireContext())); menu.findItem(R.id.menu_clear_passphrase).setVisible(TextSecurePreferences.isPassphraseLockEnabled(requireContext())); }
Example #11
Source File: RadioFragment.java From TDTChannels-APP with MIT License | 5 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { menuInflater.inflate(R.menu.fragment_radio, menu); MenuItem searchItem = menu.findItem(R.id.action_search); isShowingFavorites = false; // Change color of the search button if (getContext() != null) { Drawable drawable = DrawableCompat.wrap(searchItem.getIcon()); DrawableCompat.setTint(drawable, ContextCompat.getColor(getContext(), R.color.white)); menu.findItem(R.id.action_search).setIcon(drawable); } SearchView searchView = (SearchView) searchItem.getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { // This will be fired every time you input any character. if (mFilter != null) { mFilter.filter(newText); } return false; } }); }
Example #12
Source File: MainActivity.java From Twire with GNU General Public License v3.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_main_activity, menu); return true; }
Example #13
Source File: StreamFragment.java From Twire with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); optionsMenuItem = menu.findItem(R.id.menu_item_options); optionsMenuItem.setVisible(false); optionsMenuItem.setOnMenuItemClickListener(menuItem -> { if (mQualityButton != null) { mQualityButton.performClick(); } return true; }); }
Example #14
Source File: GroupCreateActivity.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuInflater inflater = this.getMenuInflater(); menu.clear(); inflater.inflate(R.menu.group_create, menu); super.onPrepareOptionsMenu(menu); return true; }
Example #15
Source File: SettingsPickNotificationsActivity.java From Twire with GNU General Public License v3.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_settings_notifications_choose_streamers, menu); toggleMenuItem = menu.findItem(R.id.menu_toggle_streamers); if (showEnableAll != null && showEnableAll) { toggleMenuItem.setTitle(getString(R.string.enable_all)); } return true; }
Example #16
Source File: HistoryActivity.java From incubator-weex-playground with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { if (historyManager.hasHistoryItems()) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.history, menu); } return super.onCreateOptionsMenu(menu); }
Example #17
Source File: CameraNetworkFragment.java From arcusandroid with Apache License 2.0 | 5 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if(menu.size() > 0){ if (!isPopupMode) { menu.getItem(0).setTitle(isEditMode ? getString(R.string.card_menu_done) : getString(R.string.card_menu_edit)); } else { menu.getItem(0).setTitle(""); } } super.onCreateOptionsMenu(menu, inflater); }
Example #18
Source File: AccountBillingInfoFragment.java From arcusandroid with Apache License 2.0 | 5 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (ScreenVariant.SETTINGS.equals(variant)) { return; } inflater.inflate(R.menu.menu_credit_card, menu); super.onCreateOptionsMenu(menu, inflater); }
Example #19
Source File: ActivityLog.java From tracker-control-android with GNU General Public License v3.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.logging, menu); menuSearch = menu.findItem(R.id.menu_search); SearchView searchView = (SearchView) menuSearch.getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { if (adapter != null) adapter.getFilter().filter(getUidForName(query)); return true; } @Override public boolean onQueryTextChange(String newText) { if (adapter != null) adapter.getFilter().filter(getUidForName(newText)); return true; } }); searchView.setOnCloseListener(new SearchView.OnCloseListener() { @Override public boolean onClose() { if (adapter != null) adapter.getFilter().filter(null); return true; } }); return true; }
Example #20
Source File: DownloadHistoryVideoFragment.java From Instagram-Profile-Downloader with MIT License | 5 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // Inflate a menu resource providing context menu items MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.menu_delete, menu); return true; }
Example #21
Source File: ConversationView.java From zom-android-matrix with Apache License 2.0 | 5 votes |
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // Inflate a menu resource providing context menu items MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.menu_message_context, menu); return true; }
Example #22
Source File: SettingsFragment.java From Android-Keyboard with Apache License 2.0 | 5 votes |
@Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { if (FeedbackUtils.isHelpAndFeedbackFormSupported()) { menu.add(NO_MENU_GROUP, MENU_HELP_AND_FEEDBACK /* itemId */, MENU_HELP_AND_FEEDBACK /* order */, R.string.help_and_feedback); } final int aboutResId = FeedbackUtils.getAboutKeyboardTitleResId(); if (aboutResId != 0) { menu.add(NO_MENU_GROUP, MENU_ABOUT /* itemId */, MENU_ABOUT /* order */, aboutResId); } }
Example #23
Source File: AccountActivity.java From zom-android-matrix with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_account_settings, menu); if (isEdit) { //add delete menu option } return true; }
Example #24
Source File: DevicesFragment.java From SimpleBluetoothLeTerminal with MIT License | 5 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_devices, menu); this.menu = menu; if (bluetoothAdapter == null) { menu.findItem(R.id.bt_settings).setEnabled(false); menu.findItem(R.id.ble_scan).setEnabled(false); } else if(!bluetoothAdapter.isEnabled()) { menu.findItem(R.id.ble_scan).setEnabled(false); } }
Example #25
Source File: AdvancedInstallerFragment.java From EdXposedManager with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { inflater.inflate(R.menu.menu_installer, menu); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { menu.findItem(R.id.dexopt_all).setVisible(false); menu.findItem(R.id.speed_all).setVisible(false); } }
Example #26
Source File: MainActivity.java From LiTr with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { // TODO implement these for pre-Marshmallow devices, if possible menu.removeItem(R.id.codec_list); menu.removeItem(R.id.avc_encoders); menu.removeItem(R.id.avc_decoders); } return true; }
Example #27
Source File: Fragment.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
boolean performCreateOptionsMenu(Menu menu, MenuInflater inflater) { boolean show = false; if (!mHidden) { if (mHasMenu && mMenuVisible) { show = true; onCreateOptionsMenu(menu, inflater); } if (mChildFragmentManager != null) { show |= mChildFragmentManager.dispatchCreateOptionsMenu(menu, inflater); } } return show; }
Example #28
Source File: AlbumsFragment.java From leafpicrevived with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.grid_albums, menu); menu.findItem(R.id.select_all).setIcon(ThemeHelper.getToolbarIcon(getContext(), GoogleMaterial.Icon.gmd_select_all)); menu.findItem(R.id.delete).setIcon(ThemeHelper.getToolbarIcon(getContext(), (GoogleMaterial.Icon.gmd_delete))); menu.findItem(R.id.sort_action).setIcon(ThemeHelper.getToolbarIcon(getContext(), (GoogleMaterial.Icon.gmd_sort))); menu.findItem(R.id.search_action).setIcon(ThemeHelper.getToolbarIcon(getContext(), (GoogleMaterial.Icon.gmd_search))); super.onCreateOptionsMenu(menu, inflater); }
Example #29
Source File: UserDictionaryAddWordFragment.java From openboard with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { final MenuItem actionItemAdd = menu.add(0, OPTIONS_MENU_ADD, 0, R.string.user_dict_settings_add_menu_title).setIcon(R.drawable.ic_menu_add); actionItemAdd.setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); final MenuItem actionItemDelete = menu.add(0, OPTIONS_MENU_DELETE, 0, R.string.user_dict_settings_delete).setIcon(android.R.drawable.ic_menu_delete); actionItemDelete.setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); }
Example #30
Source File: SettingsFragment.java From openboard with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { if (FeedbackUtils.isHelpAndFeedbackFormSupported()) { menu.add(NO_MENU_GROUP, MENU_HELP_AND_FEEDBACK /* itemId */, MENU_HELP_AND_FEEDBACK /* order */, R.string.help_and_feedback); } final int aboutResId = FeedbackUtils.getAboutKeyboardTitleResId(); if (aboutResId != 0) { menu.add(NO_MENU_GROUP, MENU_ABOUT /* itemId */, MENU_ABOUT /* order */, aboutResId); } }