You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

221 lines
6.2 KiB

package androidx.appcompat.view.menu;
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import androidx.appcompat.view.menu.InterfaceC0112i;
import p007c.C0488d;
import p023h0.C0829h1;
import p023h0.C0936r;
import p025i.AbstractC1012d;
/* renamed from: androidx.appcompat.view.menu.h */
/* loaded from: classes.dex */
public class C0109h {
/* renamed from: a */
public final Context f370a;
/* renamed from: b */
public final C0103e f371b;
/* renamed from: c */
public final boolean f372c;
/* renamed from: d */
public final int f373d;
/* renamed from: e */
public final int f374e;
/* renamed from: f */
public View f375f;
/* renamed from: g */
public int f376g;
/* renamed from: h */
public boolean f377h;
/* renamed from: i */
public InterfaceC0112i.InterfaceC0113a f378i;
/* renamed from: j */
public AbstractC1012d f379j;
/* renamed from: k */
public PopupWindow.OnDismissListener f380k;
/* renamed from: l */
public final PopupWindow.OnDismissListener f381l;
/* renamed from: androidx.appcompat.view.menu.h$a */
/* loaded from: classes.dex */
public class C0110a implements PopupWindow.OnDismissListener {
public C0110a() {
}
@Override // android.widget.PopupWindow.OnDismissListener
public void onDismiss() {
C0109h.this.mo4628e();
}
}
/* renamed from: androidx.appcompat.view.menu.h$b */
/* loaded from: classes.dex */
public static class C0111b {
/* renamed from: a */
public static void m4824a(Display display, Point point) {
display.getRealSize(point);
}
}
public C0109h(Context context, C0103e c0103e, View view, boolean z, int i) {
this(context, c0103e, view, z, i, 0);
}
public C0109h(Context context, C0103e c0103e, View view, boolean z, int i, int i2) {
this.f376g = 8388611;
this.f381l = new C0110a();
this.f370a = context;
this.f371b = c0103e;
this.f375f = view;
this.f372c = z;
this.f373d = i;
this.f374e = i2;
}
/* renamed from: a */
public final AbstractC1012d m4837a() {
Display defaultDisplay = ((WindowManager) this.f370a.getSystemService("window")).getDefaultDisplay();
Point point = new Point();
if (Build.VERSION.SDK_INT >= 17) {
C0111b.m4824a(defaultDisplay, point);
} else {
defaultDisplay.getSize(point);
}
AbstractC1012d view$OnKeyListenerC0094b = Math.min(point.x, point.y) >= this.f370a.getResources().getDimensionPixelSize(C0488d.abc_cascading_menus_min_smallest_width) ? new View$OnKeyListenerC0094b(this.f370a, this.f375f, this.f373d, this.f374e, this.f372c) : new View$OnKeyListenerC0116k(this.f370a, this.f371b, this.f375f, this.f373d, this.f374e, this.f372c);
view$OnKeyListenerC0094b.mo2396l(this.f371b);
view$OnKeyListenerC0094b.mo2387u(this.f381l);
view$OnKeyListenerC0094b.mo2392p(this.f375f);
view$OnKeyListenerC0094b.mo4821h(this.f378i);
view$OnKeyListenerC0094b.mo2390r(this.f377h);
view$OnKeyListenerC0094b.mo2389s(this.f376g);
return view$OnKeyListenerC0094b;
}
/* renamed from: b */
public void m4836b() {
if (m4834d()) {
this.f379j.dismiss();
}
}
/* renamed from: c */
public AbstractC1012d m4835c() {
if (this.f379j == null) {
this.f379j = m4837a();
}
return this.f379j;
}
/* renamed from: d */
public boolean m4834d() {
AbstractC1012d abstractC1012d = this.f379j;
return abstractC1012d != null && abstractC1012d.mo2024b();
}
/* renamed from: e */
public void mo4628e() {
this.f379j = null;
PopupWindow.OnDismissListener onDismissListener = this.f380k;
if (onDismissListener != null) {
onDismissListener.onDismiss();
}
}
/* renamed from: f */
public void m4833f(View view) {
this.f375f = view;
}
/* renamed from: g */
public void m4832g(boolean z) {
this.f377h = z;
AbstractC1012d abstractC1012d = this.f379j;
if (abstractC1012d != null) {
abstractC1012d.mo2390r(z);
}
}
/* renamed from: h */
public void m4831h(int i) {
this.f376g = i;
}
/* renamed from: i */
public void m4830i(PopupWindow.OnDismissListener onDismissListener) {
this.f380k = onDismissListener;
}
/* renamed from: j */
public void m4829j(InterfaceC0112i.InterfaceC0113a interfaceC0113a) {
this.f378i = interfaceC0113a;
AbstractC1012d abstractC1012d = this.f379j;
if (abstractC1012d != null) {
abstractC1012d.mo4821h(interfaceC0113a);
}
}
/* renamed from: k */
public void m4828k() {
if (!m4826m()) {
throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor");
}
}
/* renamed from: l */
public final void m4827l(int i, int i2, boolean z, boolean z2) {
AbstractC1012d m4835c = m4835c();
m4835c.mo2386v(z2);
if (z) {
if ((C0936r.m2528a(this.f376g, C0829h1.m2816r(this.f375f)) & 7) == 5) {
i -= this.f375f.getWidth();
}
m4835c.mo2388t(i);
m4835c.mo2385w(i2);
int i3 = (int) ((this.f370a.getResources().getDisplayMetrics().density * 48.0f) / 2.0f);
m4835c.m2391q(new Rect(i - i3, i2 - i3, i + i3, i2 + i3));
}
m4835c.mo2022f();
}
/* renamed from: m */
public boolean m4826m() {
if (m4834d()) {
return true;
}
if (this.f375f == null) {
return false;
}
m4827l(0, 0, false, false);
return true;
}
/* renamed from: n */
public boolean m4825n(int i, int i2) {
if (m4834d()) {
return true;
}
if (this.f375f == null) {
return false;
}
m4827l(i, i2, true, true);
return true;
}
}