Java Code Examples for android.view.MenuInflater#inflate()

The following examples show how to use android.view.MenuInflater#inflate() . 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: ConversationFragment.java    From mollyim-android with GNU General Public License v3.0 7 votes vote down vote up
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
  MenuInflater inflater = mode.getMenuInflater();
  inflater.inflate(R.menu.conversation_context, menu);

  mode.setTitle("1");

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    Window window = getActivity().getWindow();
    statusBarColor = window.getStatusBarColor();
    window.setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar));
  }

  setCorrectMenuVisibility(menu);
  AdaptiveActionsToolbar.adjustMenuActions(menu, 10, requireActivity().getWindow().getDecorView().getMeasuredWidth());
  listener.onMessageActionToolbarOpened();
  return true;
}
 
Example 2
Source File: DetailChannelActivity.java    From TDTChannels-APP with MIT License 6 votes vote down vote up
@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 3
Source File: AlbumsFragment.java    From leafpicrevived with GNU General Public License v3.0 5 votes vote down vote up
@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 4
Source File: DevicesFragment.java    From SimpleBluetoothLeTerminal with MIT License 5 votes vote down vote up
@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 5
Source File: AccountActivity.java    From zom-android-matrix with Apache License 2.0 5 votes vote down vote up
@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 6
Source File: GroupCreateActivity.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@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 7
Source File: ConversationPopupActivity.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  MenuInflater inflater = this.getMenuInflater();
  menu.clear();

  inflater.inflate(R.menu.conversation_popup, menu);
  return true;
}
 
Example 8
Source File: ConversationListFragment.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@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 9
Source File: VerifyIdentityActivity.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreateContextMenu(ContextMenu menu, View view,
                                ContextMenuInfo menuInfo)
{
  super.onCreateContextMenu(menu, view, menuInfo);

  if (fingerprint != null) {
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.verify_display_fragment_context_menu, menu);
  }
}
 
Example 10
Source File: ThreadFragment.java    From lttrs-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
    inflater.inflate(R.menu.fragment_thread, menu);
    menu.findItem(R.id.action_archive).setVisible(menuConfiguration.archive);
    final MenuItem removeLabelItem = menu.findItem(R.id.action_remove_label);
    removeLabelItem.setVisible(menuConfiguration.removeLabel);
    removeLabelItem.setTitle(getString(R.string.remove_label_x, threadViewModel.getLabel()));
    menu.findItem(R.id.action_move_to_inbox).setVisible(menuConfiguration.moveToInbox);
    menu.findItem(R.id.action_move_to_trash).setVisible(menuConfiguration.moveToTrash);
    menu.findItem(R.id.action_mark_important).setVisible(menuConfiguration.markImportant);
    menu.findItem(R.id.action_mark_not_important).setVisible(menuConfiguration.markNotImportant);
    super.onCreateOptionsMenu(menu, inflater);
}
 
Example 11
Source File: DownloadHistoryVideoFragment.java    From Instagram-Profile-Downloader with MIT License 5 votes vote down vote up
@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 12
Source File: ModulesFragment.java    From EdXposedManager with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
    inflater.inflate(R.menu.menu_modules, menu);
    mSearchView = (SearchView) menu.findItem(R.id.app_search).getActionView();
    mSearchView.setOnQueryTextListener(mSearchListener);
}
 
Example 13
Source File: MainActivity.java    From FridaHooker with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);
    return true;
}
 
Example 14
Source File: CustomCaptureActivity.java    From incubator-weex-playground with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater menuInflater = getMenuInflater();
    menuInflater.inflate(R.menu.capture, menu);
    return super.onCreateOptionsMenu(menu);
}
 
Example 15
Source File: SwipeRefreshMultipleViewsFragment.java    From views-widgets-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.main_menu, menu);
}
 
Example 16
Source File: ApplicationFragment.java    From EdXposedManager with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
    inflater.inflate(R.menu.menu_app_list, menu);
    mSearchView = (SearchView) menu.findItem(R.id.app_search).getActionView();
    mSearchView.setOnQueryTextListener(mSearchListener);
}
 
Example 17
Source File: MainActivity.java    From Paddle-Lite-Demo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_action_options, menu);
    return true;
}
 
Example 18
Source File: TerminalFragment.java    From SimpleUsbTerminal with MIT License 4 votes vote down vote up
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_terminal, menu);
}
 
Example 19
Source File: MainActivity.java    From Paddle-Lite-Demo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_action_options, menu);
    return true;
}
 
Example 20
Source File: ScannerFragment.java    From connectivity-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.scanner_menu, menu);
}