discord-jadx/app/src/main/java/androidx/appcompat/widget/AppCompatPopupWindow.java

69 lines
2.5 KiB
Java

package androidx.appcompat.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.PopupWindow;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;
import androidx.appcompat.R;
import androidx.core.widget.PopupWindowCompat;
public class AppCompatPopupWindow extends PopupWindow {
private static final boolean COMPAT_OVERLAP_ANCHOR = false;
private boolean mOverlapAnchor;
public AppCompatPopupWindow(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i) {
super(context, attributeSet, i);
init(context, attributeSet, i, 0);
}
public AppCompatPopupWindow(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i, @StyleRes int i2) {
super(context, attributeSet, i, i2);
init(context, attributeSet, i, i2);
}
private void init(Context context, AttributeSet attributeSet, int i, int i2) {
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.PopupWindow, i, i2);
int i3 = R.styleable.PopupWindow_overlapAnchor;
if (obtainStyledAttributes.hasValue(i3)) {
setSupportOverlapAnchor(obtainStyledAttributes.getBoolean(i3, false));
}
setBackgroundDrawable(obtainStyledAttributes.getDrawable(R.styleable.PopupWindow_android_popupBackground));
obtainStyledAttributes.recycle();
}
private void setSupportOverlapAnchor(boolean z2) {
if (COMPAT_OVERLAP_ANCHOR) {
this.mOverlapAnchor = z2;
} else {
PopupWindowCompat.setOverlapAnchor(this, z2);
}
}
@Override // android.widget.PopupWindow
public void showAsDropDown(View view, int i, int i2) {
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
i2 -= view.getHeight();
}
super.showAsDropDown(view, i, i2);
}
@Override // android.widget.PopupWindow
public void showAsDropDown(View view, int i, int i2, int i3) {
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
i2 -= view.getHeight();
}
super.showAsDropDown(view, i, i2, i3);
}
@Override // android.widget.PopupWindow
public void update(View view, int i, int i2, int i3, int i4) {
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
i2 -= view.getHeight();
}
super.update(view, i, i2, i3, i4);
}
}