2021-06-27 20:44:35 +00:00
|
|
|
package c.o.a.q;
|
|
|
|
|
|
|
|
import android.view.GestureDetector;
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import c.o.a.b;
|
|
|
|
import c.o.a.q.c;
|
|
|
|
import com.otaliastudios.cameraview.CameraView;
|
|
|
|
/* compiled from: ScrollGestureFinder */
|
|
|
|
public class f extends c {
|
|
|
|
public static final b d = new b(f.class.getSimpleName());
|
|
|
|
public GestureDetector e;
|
|
|
|
public boolean f;
|
|
|
|
public float g;
|
|
|
|
|
|
|
|
/* compiled from: ScrollGestureFinder */
|
|
|
|
public class a extends GestureDetector.SimpleOnGestureListener {
|
|
|
|
public final /* synthetic */ c.a i;
|
|
|
|
|
|
|
|
public a(c.a aVar) {
|
|
|
|
this.i = aVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:20:0x00a3 */
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:21:0x00ae */
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:24:0x00bf */
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:25:0x00c3 */
|
|
|
|
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
|
|
|
|
public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
|
|
|
|
a aVar = a.SCROLL_HORIZONTAL;
|
|
|
|
b bVar = f.d;
|
|
|
|
boolean z2 = false;
|
|
|
|
bVar.a(1, "onScroll:", "distanceX=" + f, "distanceY=" + f2);
|
|
|
|
if (motionEvent == null || motionEvent2 == null) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-07-13 20:23:20 +00:00
|
|
|
if (motionEvent.getX() == f.this.f1499c[0].x) {
|
2021-06-27 20:44:35 +00:00
|
|
|
float y2 = motionEvent.getY();
|
|
|
|
f fVar = f.this;
|
2021-07-13 20:23:20 +00:00
|
|
|
if (y2 == fVar.f1499c[0].y) {
|
2021-06-27 20:44:35 +00:00
|
|
|
if (fVar.b == aVar) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
2021-07-13 20:23:20 +00:00
|
|
|
f.this.f1499c[1].set(motionEvent2.getX(), motionEvent2.getY());
|
2021-06-27 20:44:35 +00:00
|
|
|
f fVar2 = f.this;
|
|
|
|
c.a aVar2 = this.i;
|
|
|
|
fVar2.g = !z2 ? f / ((float) CameraView.this.getWidth()) : f2 / ((float) CameraView.this.getHeight());
|
|
|
|
f fVar3 = f.this;
|
|
|
|
fVar3.g = !z2 ? -fVar3.g : fVar3.g;
|
|
|
|
fVar3.f = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean z3 = Math.abs(f) >= Math.abs(f2);
|
|
|
|
f fVar4 = f.this;
|
|
|
|
if (!z3) {
|
|
|
|
aVar = a.SCROLL_VERTICAL;
|
|
|
|
}
|
|
|
|
fVar4.b = aVar;
|
2021-07-13 20:23:20 +00:00
|
|
|
fVar4.f1499c[0].set(motionEvent.getX(), motionEvent.getY());
|
2021-06-27 20:44:35 +00:00
|
|
|
z2 = z3;
|
2021-07-13 20:23:20 +00:00
|
|
|
f.this.f1499c[1].set(motionEvent2.getX(), motionEvent2.getY());
|
2021-06-27 20:44:35 +00:00
|
|
|
f fVar2 = f.this;
|
|
|
|
c.a aVar2 = this.i;
|
|
|
|
fVar2.g = !z2 ? f / ((float) CameraView.this.getWidth()) : f2 / ((float) CameraView.this.getHeight());
|
|
|
|
f fVar3 = f.this;
|
|
|
|
fVar3.g = !z2 ? -fVar3.g : fVar3.g;
|
|
|
|
fVar3.f = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public f(@NonNull c.a aVar) {
|
|
|
|
super(aVar, 2);
|
|
|
|
CameraView.b bVar = (CameraView.b) aVar;
|
|
|
|
GestureDetector gestureDetector = new GestureDetector(bVar.g(), new a(bVar));
|
|
|
|
this.e = gestureDetector;
|
|
|
|
gestureDetector.setIsLongpressEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.o.a.q.c
|
|
|
|
public float b(float f, float f2, float f3) {
|
|
|
|
return ((f3 - f2) * this.g * 2.0f) + f;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean c(@NonNull MotionEvent motionEvent) {
|
|
|
|
if (motionEvent.getAction() == 0) {
|
|
|
|
this.f = false;
|
|
|
|
}
|
|
|
|
this.e.onTouchEvent(motionEvent);
|
|
|
|
if (this.f) {
|
|
|
|
d.a(1, "Notifying a gesture of type", this.b.name());
|
|
|
|
}
|
|
|
|
return this.f;
|
|
|
|
}
|
|
|
|
}
|