code: @Override
      public void onMenuStateChanged(@NonNull MenuState menuState) {
          if (menuState == MenuState.CLOSING && popupMenu != null) {
              popupMenu.dismiss();
          }
      }
docs: OnMenuStateChangedListener