66 lines
1.9 KiB
Java
66 lines
1.9 KiB
Java
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$styleable;
|
|
import androidx.core.widget.PopupWindowCompat;
|
|
|
|
/* loaded from: classes.dex */
|
|
class AppCompatPopupWindow extends PopupWindow {
|
|
private static final boolean b;
|
|
private boolean a;
|
|
|
|
static {
|
|
b = Build.VERSION.SDK_INT < 21;
|
|
}
|
|
|
|
public AppCompatPopupWindow(Context context, AttributeSet attributeSet, int i, int i2) {
|
|
super(context, attributeSet, i, i2);
|
|
a(context, attributeSet, i, i2);
|
|
}
|
|
|
|
private void a(Context context, AttributeSet attributeSet, int i, int i2) {
|
|
TintTypedArray a = TintTypedArray.a(context, attributeSet, R$styleable.PopupWindow, i, i2);
|
|
if (a.g(R$styleable.PopupWindow_overlapAnchor)) {
|
|
a(a.a(R$styleable.PopupWindow_overlapAnchor, false));
|
|
}
|
|
setBackgroundDrawable(a.b(R$styleable.PopupWindow_android_popupBackground));
|
|
a.a();
|
|
}
|
|
|
|
@Override // android.widget.PopupWindow
|
|
public void showAsDropDown(View view, int i, int i2) {
|
|
if (b && this.a) {
|
|
i2 -= view.getHeight();
|
|
}
|
|
super.showAsDropDown(view, i, i2);
|
|
}
|
|
|
|
@Override // android.widget.PopupWindow
|
|
public void update(View view, int i, int i2, int i3, int i4) {
|
|
if (b && this.a) {
|
|
i2 -= view.getHeight();
|
|
}
|
|
super.update(view, i, i2, i3, i4);
|
|
}
|
|
|
|
@Override // android.widget.PopupWindow
|
|
public void showAsDropDown(View view, int i, int i2, int i3) {
|
|
if (b && this.a) {
|
|
i2 -= view.getHeight();
|
|
}
|
|
super.showAsDropDown(view, i, i2, i3);
|
|
}
|
|
|
|
private void a(boolean z) {
|
|
if (b) {
|
|
this.a = z;
|
|
} else {
|
|
PopupWindowCompat.a(this, z);
|
|
}
|
|
}
|
|
}
|