@Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.about_menu_option:
        Navigation.findNavController(requireView())
            .navigate(MainFragmentDirections.actionMainFragmentToAboutAnySoftKeyboardFragment());
        return true;
      case R.id.tweaks_menu_option:
        Navigation.findNavController(requireView())
            .navigate(MainFragmentDirections.actionMainFragmentToMainTweaksFragment());
        return true;
      case R.id.backup_prefs:
        mDialogController.showDialog(R.id.backup_prefs);
        return true;
      case R.id.restore_prefs:
        mDialogController.showDialog(R.id.restore_prefs);
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
@Test
  @Config(sdk = Build.VERSION_CODES.JELLY_BEAN_MR2)
  @Ignore("Robolectric does not support this API level")
  public void testBackupMenuItemNotSupportedPreKitKat() throws Exception {
    final MainFragment fragment = startFragment();
    final FragmentActivity activity = fragment.getActivity();

    Menu menu = Shadows.shadowOf(activity).getOptionsMenu();
    Assert.assertNotNull(menu);
    final MenuItem item = menu.findItem(R.id.backup_prefs);

    fragment.onOptionsItemSelected(item);
    TestRxSchedulers.foregroundFlushAllJobs();

    final AlertDialog dialog = GeneralDialogTestUtil.getLatestShownDialog();
    Assert.assertNotSame(GeneralDialogTestUtil.NO_DIALOG, dialog);
    Assert.assertEquals(
        getApplicationContext().getText(R.string.backup_restore_not_support_before_kitkat),
        GeneralDialogTestUtil.getTitleFromDialog(dialog));
  }