code: private OnApplyWindowInsetsListener createWindowInsetsListener() {
          return new OnApplyWindowInsetsListener() {
  
              @Override
              public WindowInsetsCompat onApplyWindowInsets(final View v,
                                                            final WindowInsetsCompat insets) {
                  systemWindowInsets = insets.hasSystemWindowInsets() ?
                          new Rect(insets.getSystemWindowInsetLeft(),
                                  insets.getSystemWindowInsetTop(),
                                  insets.getSystemWindowInsetRight(),
                                  insets.getSystemWindowInsetBottom()) : null;
                  adaptLayoutParams();
                  return insets;
              }
  
          };
      }
docs: Creates and returns a listener, which allows to observe when window insets are applied to the
  root view of the view hierarchy, which is modified by the decorator.
  
  @return The listener, which has been created, as an instance of the type {@link
  OnApplyWindowInsetsListener}