content: package androidx.appcompat.widget;
  
  import android.content.Context;
  import android.os.Build;
  import android.util.AttributeSet;
  import android.view.View;
  import android.widget.PopupWindow;
  import androidx.appcompat.R;
  import androidx.core.widget.PopupWindowCompat;
  
  class AppCompatPopupWindow extends PopupWindow {
      private static final boolean COMPAT_OVERLAP_ANCHOR = (Build.VERSION.SDK_INT < 21);
      private boolean mOverlapAnchor;
  
      public AppCompatPopupWindow(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
          init(context, attrs, defStyleAttr, 0);
      }
  
      public AppCompatPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
          super(context, attrs, defStyleAttr, defStyleRes);
          init(context, attrs, defStyleAttr, defStyleRes);
      }
  
      private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
          TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.PopupWindow, defStyleAttr, defStyleRes);
          if (obtainStyledAttributes.hasValue(R.styleable.PopupWindow_overlapAnchor)) {
              setSupportOverlapAnchor(obtainStyledAttributes.getBoolean(R.styleable.PopupWindow_overlapAnchor, false));
          }
          setBackgroundDrawable(obtainStyledAttributes.getDrawable(R.styleable.PopupWindow_android_popupBackground));
          obtainStyledAttributes.recycle();
      }
  
      private void setSupportOverlapAnchor(boolean overlapAnchor) {
          if (COMPAT_OVERLAP_ANCHOR) {
              this.mOverlapAnchor = overlapAnchor;
          } else {
              PopupWindowCompat.setOverlapAnchor(this, overlapAnchor);
          }
      }
  
      public void showAsDropDown(View anchor, int xoff, int yoff) {
          if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
              yoff -= anchor.getHeight();
          }
          super.showAsDropDown(anchor, xoff, yoff);
      }
  
      public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
          if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
              yoff -= anchor.getHeight();
          }
          super.showAsDropDown(anchor, xoff, yoff, gravity);
      }
  
      public void update(View anchor, int xoff, int yoff, int width, int height) {
          if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
              yoff -= anchor.getHeight();
          }
          super.update(anchor, xoff, yoff, width, height);
      }
  }
  