398 lines
13 KiB
Java
398 lines
13 KiB
Java
package androidx.appcompat.widget;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Rect;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Build;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.AbsListView;
|
|
import android.widget.AdapterView;
|
|
import android.widget.ListAdapter;
|
|
import android.widget.ListView;
|
|
import androidx.core.view.ViewPropertyAnimatorCompat;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import o.C15993kKZ;
|
|
import o.RNg;
|
|
import o.SYO;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class DropDownListView extends ListView {
|
|
jbe a;
|
|
private boolean b;
|
|
private ViewPropertyAnimatorCompat c;
|
|
private boolean d;
|
|
public boolean e;
|
|
private int f;
|
|
private C15993kKZ g;
|
|
private int h;
|
|
private int i;
|
|
private int j;
|
|
private Sts k;
|
|
private int l;
|
|
|
|
/* renamed from: o, reason: collision with root package name */
|
|
private final Rect f6375o;
|
|
|
|
public DropDownListView(Context context, boolean z) {
|
|
super(context, null, SYO.IeS.dropDownListViewStyle);
|
|
this.f6375o = new Rect();
|
|
this.h = 0;
|
|
this.l = 0;
|
|
this.j = 0;
|
|
this.f = 0;
|
|
this.d = z;
|
|
setCacheColorHint(0);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean isInTouchMode() {
|
|
return (this.d && this.e) || super.isInTouchMode();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean hasWindowFocus() {
|
|
return this.d || super.hasWindowFocus();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean isFocused() {
|
|
return this.d || super.isFocused();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public boolean hasFocus() {
|
|
return this.d || super.hasFocus();
|
|
}
|
|
|
|
@Override // android.widget.AbsListView
|
|
public void setSelector(Drawable drawable) {
|
|
Sts sts = drawable != null ? new Sts(drawable) : null;
|
|
this.k = sts;
|
|
super.setSelector(sts);
|
|
Rect rect = new Rect();
|
|
if (drawable != null) {
|
|
drawable.getPadding(rect);
|
|
}
|
|
this.h = rect.left;
|
|
this.l = rect.top;
|
|
this.j = rect.right;
|
|
this.f = rect.bottom;
|
|
}
|
|
|
|
@Override // android.widget.AbsListView, android.view.ViewGroup, android.view.View
|
|
protected void drawableStateChanged() {
|
|
if (this.a != null) {
|
|
return;
|
|
}
|
|
super.drawableStateChanged();
|
|
Sts sts = this.k;
|
|
if (sts != null) {
|
|
sts.c = true;
|
|
}
|
|
e();
|
|
}
|
|
|
|
@Override // android.widget.ListView, android.widget.AbsListView, android.view.ViewGroup, android.view.View
|
|
protected void dispatchDraw(Canvas canvas) {
|
|
Drawable selector;
|
|
if (!this.f6375o.isEmpty() && (selector = getSelector()) != null) {
|
|
selector.setBounds(this.f6375o);
|
|
selector.draw(canvas);
|
|
}
|
|
super.dispatchDraw(canvas);
|
|
}
|
|
|
|
@Override // android.widget.AbsListView, android.view.View
|
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
|
if (motionEvent.getAction() == 0) {
|
|
this.i = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY());
|
|
}
|
|
jbe jbeVar = this.a;
|
|
if (jbeVar != null) {
|
|
jbeVar.b.a = null;
|
|
jbeVar.b.removeCallbacks(jbeVar);
|
|
}
|
|
return super.onTouchEvent(motionEvent);
|
|
}
|
|
|
|
public int e(int i, int i2, int i3, int i4, int i5) {
|
|
int makeMeasureSpec;
|
|
int listPaddingTop = getListPaddingTop();
|
|
int listPaddingBottom = getListPaddingBottom();
|
|
int dividerHeight = getDividerHeight();
|
|
Drawable divider = getDivider();
|
|
ListAdapter adapter = getAdapter();
|
|
int i6 = listPaddingTop + listPaddingBottom;
|
|
if (adapter == null) {
|
|
return i6;
|
|
}
|
|
if (dividerHeight <= 0 || divider == null) {
|
|
dividerHeight = 0;
|
|
}
|
|
int count = adapter.getCount();
|
|
int i7 = 0;
|
|
int i8 = 0;
|
|
int i9 = 0;
|
|
View view = null;
|
|
while (i7 < count) {
|
|
int itemViewType = adapter.getItemViewType(i7);
|
|
if (itemViewType != i8) {
|
|
view = null;
|
|
i8 = itemViewType;
|
|
}
|
|
view = adapter.getView(i7, view, this);
|
|
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
|
if (layoutParams == null) {
|
|
layoutParams = generateDefaultLayoutParams();
|
|
view.setLayoutParams(layoutParams);
|
|
}
|
|
if (layoutParams.height > 0) {
|
|
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(layoutParams.height, 1073741824);
|
|
} else {
|
|
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
|
}
|
|
view.measure(i, makeMeasureSpec);
|
|
view.forceLayout();
|
|
if (i7 > 0) {
|
|
i6 += dividerHeight;
|
|
}
|
|
i6 += view.getMeasuredHeight();
|
|
if (i6 >= i4) {
|
|
return (i5 < 0 || i7 <= i5 || i9 <= 0 || i6 == i4) ? i4 : i9;
|
|
}
|
|
if (i5 >= 0 && i7 >= i5) {
|
|
i9 = i6;
|
|
}
|
|
i7++;
|
|
}
|
|
return i6;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static class Sts extends RNg {
|
|
boolean c;
|
|
|
|
Sts(Drawable drawable) {
|
|
super(drawable);
|
|
this.c = true;
|
|
}
|
|
|
|
@Override // o.RNg, android.graphics.drawable.Drawable
|
|
public final boolean setState(int[] iArr) {
|
|
if (this.c) {
|
|
return super.setState(iArr);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // o.RNg, android.graphics.drawable.Drawable
|
|
public final void draw(Canvas canvas) {
|
|
if (this.c) {
|
|
super.draw(canvas);
|
|
}
|
|
}
|
|
|
|
@Override // o.RNg, android.graphics.drawable.Drawable
|
|
public final void setHotspot(float f, float f2) {
|
|
if (this.c) {
|
|
super.setHotspot(f, f2);
|
|
}
|
|
}
|
|
|
|
@Override // o.RNg, android.graphics.drawable.Drawable
|
|
public final void setHotspotBounds(int i, int i2, int i3, int i4) {
|
|
if (this.c) {
|
|
super.setHotspotBounds(i, i2, i3, i4);
|
|
}
|
|
}
|
|
|
|
@Override // o.RNg, android.graphics.drawable.Drawable
|
|
public final boolean setVisible(boolean z, boolean z2) {
|
|
if (this.c) {
|
|
return super.setVisible(z, z2);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onHoverEvent(MotionEvent motionEvent) {
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (actionMasked == 10 && this.a == null) {
|
|
jbe jbeVar = new jbe(this);
|
|
this.a = jbeVar;
|
|
jbeVar.b.post(jbeVar);
|
|
}
|
|
boolean onHoverEvent = super.onHoverEvent(motionEvent);
|
|
if (actionMasked == 9 || actionMasked == 7) {
|
|
int pointToPosition = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY());
|
|
if (pointToPosition != -1 && pointToPosition != getSelectedItemPosition()) {
|
|
View childAt = getChildAt(pointToPosition - getFirstVisiblePosition());
|
|
if (childAt.isEnabled()) {
|
|
requestFocus();
|
|
if (Build.VERSION.SDK_INT >= 30 && RVV.d()) {
|
|
RVV.e(this, pointToPosition, childAt);
|
|
} else {
|
|
setSelectionFromTop(pointToPosition, childAt.getTop() - getTop());
|
|
}
|
|
}
|
|
e();
|
|
}
|
|
} else {
|
|
setSelection(-1);
|
|
}
|
|
return onHoverEvent;
|
|
}
|
|
|
|
@Override // android.widget.ListView, android.widget.AbsListView, android.widget.AdapterView, android.view.ViewGroup, android.view.View
|
|
protected void onDetachedFromWindow() {
|
|
this.a = null;
|
|
super.onDetachedFromWindow();
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:6:0x0010, code lost:
|
|
|
|
if (r2 != 3) goto L65;
|
|
*/
|
|
/* JADX WARN: Removed duplicated region for block: B:11:0x014b */
|
|
/* JADX WARN: Removed duplicated region for block: B:17:0x0162 */
|
|
/* JADX WARN: Removed duplicated region for block: B:25:0x0146 */
|
|
/* JADX WARN: Removed duplicated region for block: B:9:0x012e A[ADDED_TO_REGION] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public boolean iK_(android.view.MotionEvent r17, int r18) {
|
|
/*
|
|
Method dump skipped, instructions count: 369
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.DropDownListView.iK_(android.view.MotionEvent, int):boolean");
|
|
}
|
|
|
|
private void e() {
|
|
Drawable selector = getSelector();
|
|
if (selector != null && this.b && isPressed()) {
|
|
selector.setState(getDrawableState());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public class jbe implements Runnable {
|
|
final DropDownListView b;
|
|
|
|
jbe(DropDownListView dropDownListView) {
|
|
this.b = dropDownListView;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
this.b.a = null;
|
|
this.b.drawableStateChanged();
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static class RVV {
|
|
private static Method b;
|
|
private static boolean c;
|
|
private static Method d;
|
|
private static Method e;
|
|
|
|
static {
|
|
try {
|
|
Method declaredMethod = AbsListView.class.getDeclaredMethod("positionSelector", Integer.TYPE, View.class, Boolean.TYPE, Float.TYPE, Float.TYPE);
|
|
e = declaredMethod;
|
|
declaredMethod.setAccessible(true);
|
|
Method declaredMethod2 = AdapterView.class.getDeclaredMethod("setSelectedPositionInt", Integer.TYPE);
|
|
b = declaredMethod2;
|
|
declaredMethod2.setAccessible(true);
|
|
Method declaredMethod3 = AdapterView.class.getDeclaredMethod("setNextSelectedPositionInt", Integer.TYPE);
|
|
d = declaredMethod3;
|
|
declaredMethod3.setAccessible(true);
|
|
c = true;
|
|
} catch (NoSuchMethodException unused) {
|
|
}
|
|
}
|
|
|
|
static void e(DropDownListView dropDownListView, int i, View view) {
|
|
try {
|
|
e.invoke(dropDownListView, Integer.valueOf(i), view, Boolean.FALSE, -1, -1);
|
|
b.invoke(dropDownListView, Integer.valueOf(i));
|
|
d.invoke(dropDownListView, Integer.valueOf(i));
|
|
} catch (IllegalAccessException | InvocationTargetException unused) {
|
|
}
|
|
}
|
|
|
|
static boolean d() {
|
|
return c;
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static class IeS {
|
|
static void a(View view, float f, float f2) {
|
|
view.drawableHotspotChanged(f, f2);
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static class HBt {
|
|
private static final Field a;
|
|
|
|
static {
|
|
Field field;
|
|
try {
|
|
field = AbsListView.class.getDeclaredField("mIsChildViewEnabled");
|
|
try {
|
|
field.setAccessible(true);
|
|
} catch (NoSuchFieldException unused) {
|
|
}
|
|
} catch (NoSuchFieldException unused2) {
|
|
field = null;
|
|
}
|
|
a = field;
|
|
}
|
|
|
|
static boolean if_(AbsListView absListView) {
|
|
Field field = a;
|
|
if (field == null) {
|
|
return false;
|
|
}
|
|
try {
|
|
return field.getBoolean(absListView);
|
|
} catch (IllegalAccessException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static void ig_(AbsListView absListView, boolean z) {
|
|
Field field = a;
|
|
if (field != null) {
|
|
try {
|
|
field.set(absListView, Boolean.valueOf(z));
|
|
} catch (IllegalAccessException unused) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static class LWm {
|
|
static boolean id_(AbsListView absListView) {
|
|
return absListView.isSelectedChildViewEnabled();
|
|
}
|
|
|
|
static void ie_(AbsListView absListView, boolean z) {
|
|
absListView.setSelectedChildViewEnabled(z);
|
|
}
|
|
}
|
|
}
|