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.

230 lines
7.4 KiB

package p028j;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
import p025i.InterfaceC1015g;
/* renamed from: j.l2 */
/* loaded from: classes.dex */
public abstract class AbstractView$OnTouchListenerC1140l2 implements View.OnTouchListener, View.OnAttachStateChangeListener {
/* renamed from: d */
public final float f2761d;
/* renamed from: e */
public final int f2762e;
/* renamed from: f */
public final int f2763f;
/* renamed from: g */
public final View f2764g;
/* renamed from: h */
public Runnable f2765h;
/* renamed from: i */
public Runnable f2766i;
/* renamed from: j */
public boolean f2767j;
/* renamed from: k */
public int f2768k;
/* renamed from: l */
public final int[] f2769l = new int[2];
/* renamed from: j.l2$a */
/* loaded from: classes.dex */
public class RunnableC1141a implements Runnable {
public RunnableC1141a() {
}
@Override // java.lang.Runnable
public void run() {
ViewParent parent = AbstractView$OnTouchListenerC1140l2.this.f2764g.getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
}
}
/* renamed from: j.l2$b */
/* loaded from: classes.dex */
public class RunnableC1142b implements Runnable {
public RunnableC1142b() {
}
@Override // java.lang.Runnable
public void run() {
AbstractView$OnTouchListenerC1140l2.this.m2049e();
}
}
public AbstractView$OnTouchListenerC1140l2(View view) {
this.f2764g = view;
view.setLongClickable(true);
view.addOnAttachStateChangeListener(this);
this.f2761d = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
int tapTimeout = ViewConfiguration.getTapTimeout();
this.f2762e = tapTimeout;
this.f2763f = (tapTimeout + ViewConfiguration.getLongPressTimeout()) / 2;
}
/* renamed from: h */
public static boolean m2046h(View view, float f, float f2, float f3) {
float f4 = -f3;
return f >= f4 && f2 >= f4 && f < ((float) (view.getRight() - view.getLeft())) + f3 && f2 < ((float) (view.getBottom() - view.getTop())) + f3;
}
/* renamed from: a */
public final void m2051a() {
Runnable runnable = this.f2766i;
if (runnable != null) {
this.f2764g.removeCallbacks(runnable);
}
Runnable runnable2 = this.f2765h;
if (runnable2 != null) {
this.f2764g.removeCallbacks(runnable2);
}
}
/* renamed from: b */
public abstract InterfaceC1015g mo1889b();
/* renamed from: c */
public abstract boolean mo1888c();
/* renamed from: d */
public boolean mo2050d() {
InterfaceC1015g mo1889b = mo1889b();
if (mo1889b == null || !mo1889b.mo2024b()) {
return true;
}
mo1889b.dismiss();
return true;
}
/* renamed from: e */
public void m2049e() {
m2051a();
View view = this.f2764g;
if (view.isEnabled() && !view.isLongClickable() && mo1888c()) {
view.getParent().requestDisallowInterceptTouchEvent(true);
long uptimeMillis = SystemClock.uptimeMillis();
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
view.onTouchEvent(obtain);
obtain.recycle();
this.f2767j = true;
}
}
/* renamed from: f */
public final boolean m2048f(MotionEvent motionEvent) {
C1127k2 c1127k2;
View view = this.f2764g;
InterfaceC1015g mo1889b = mo1889b();
if (mo1889b == null || !mo1889b.mo2024b() || (c1127k2 = (C1127k2) mo1889b.mo2019k()) == null || !c1127k2.isShown()) {
return false;
}
MotionEvent obtainNoHistory = MotionEvent.obtainNoHistory(motionEvent);
m2045i(view, obtainNoHistory);
m2044j(c1127k2, obtainNoHistory);
boolean mo1847e = c1127k2.mo1847e(obtainNoHistory, this.f2768k);
obtainNoHistory.recycle();
int actionMasked = motionEvent.getActionMasked();
return mo1847e && (actionMasked != 1 && actionMasked != 3);
}
/* JADX WARN: Code restructure failed: missing block: B:12:0x0017, code lost:
if (r1 != 3) goto L13;
*/
/* renamed from: g */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public final boolean m2047g(MotionEvent motionEvent) {
View view = this.f2764g;
if (view.isEnabled()) {
int actionMasked = motionEvent.getActionMasked();
if (actionMasked != 0) {
if (actionMasked != 1) {
if (actionMasked == 2) {
int findPointerIndex = motionEvent.findPointerIndex(this.f2768k);
if (findPointerIndex >= 0 && !m2046h(view, motionEvent.getX(findPointerIndex), motionEvent.getY(findPointerIndex), this.f2761d)) {
m2051a();
view.getParent().requestDisallowInterceptTouchEvent(true);
return true;
}
}
}
m2051a();
} else {
this.f2768k = motionEvent.getPointerId(0);
if (this.f2765h == null) {
this.f2765h = new RunnableC1141a();
}
view.postDelayed(this.f2765h, this.f2762e);
if (this.f2766i == null) {
this.f2766i = new RunnableC1142b();
}
view.postDelayed(this.f2766i, this.f2763f);
}
return false;
}
return false;
}
/* renamed from: i */
public final boolean m2045i(View view, MotionEvent motionEvent) {
int[] iArr = this.f2769l;
view.getLocationOnScreen(iArr);
motionEvent.offsetLocation(iArr[0], iArr[1]);
return true;
}
/* renamed from: j */
public final boolean m2044j(View view, MotionEvent motionEvent) {
int[] iArr = this.f2769l;
view.getLocationOnScreen(iArr);
motionEvent.offsetLocation(-iArr[0], -iArr[1]);
return true;
}
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
boolean z;
boolean z2 = this.f2767j;
if (z2) {
z = m2048f(motionEvent) || !mo2050d();
} else {
z = m2047g(motionEvent) && mo1888c();
if (z) {
long uptimeMillis = SystemClock.uptimeMillis();
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
this.f2764g.onTouchEvent(obtain);
obtain.recycle();
}
}
this.f2767j = z;
return z || z2;
}
@Override // android.view.View.OnAttachStateChangeListener
public void onViewAttachedToWindow(View view) {
}
@Override // android.view.View.OnAttachStateChangeListener
public void onViewDetachedFromWindow(View view) {
this.f2767j = false;
this.f2768k = -1;
Runnable runnable = this.f2765h;
if (runnable != null) {
this.f2764g.removeCallbacks(runnable);
}
}
}