@Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    // Only show dark mode option when there is at least 1 account.
    if (users.length >= 1) {
      menu.findItem(R.id.switch_ui_mode).setVisible(true);
      menu.findItem(R.id.switch_ui_mode)
          .setTitle(darkModeEnabled ? R.string.switch_ui_mode_light : R.string.switch_ui_mode_dark);
    } else {
      menu.findItem(R.id.switch_ui_mode).setVisible(false);
    }
    return true;
  }
Invoked when a context menu/action bar item is clicked/tapped.

@return {@code true} if the event was consumed, {@code false} otherwise.
java/com/google/android/apps/authenticator/AuthenticatorActivity.java