- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
71 lines
2.9 KiB
Java
71 lines
2.9 KiB
Java
package com.google.android.exoplayer2.video.spherical;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.PointF;
|
|
import android.view.GestureDetector;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import com.google.android.exoplayer2.video.spherical.OrientationListener;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class TouchTracker extends GestureDetector.SimpleOnGestureListener implements View.OnTouchListener, OrientationListener.Listener {
|
|
public final GestureDetector gestureDetector;
|
|
public final Listener listener;
|
|
public final float pxPerDegrees;
|
|
public final PointF previousTouchPointPx = new PointF();
|
|
public final PointF accumulatedTouchOffsetDegrees = new PointF();
|
|
public volatile float roll = 3.1415927f;
|
|
|
|
public interface Listener {
|
|
void onScrollChange(PointF pointF);
|
|
|
|
boolean onSingleTapUp(MotionEvent motionEvent);
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.video.spherical.OrientationListener.Listener
|
|
public void onOrientationChange(float[] fArr, float f) {
|
|
this.roll = -f;
|
|
}
|
|
|
|
public TouchTracker(Context context, Listener listener, float f) {
|
|
this.listener = listener;
|
|
this.pxPerDegrees = f;
|
|
this.gestureDetector = new GestureDetector(context, this);
|
|
}
|
|
|
|
@Override // android.view.View.OnTouchListener
|
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
|
return this.gestureDetector.onTouchEvent(motionEvent);
|
|
}
|
|
|
|
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
|
|
public boolean onDown(MotionEvent motionEvent) {
|
|
this.previousTouchPointPx.set(motionEvent.getX(), motionEvent.getY());
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
|
|
public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
|
|
float x = (motionEvent2.getX() - this.previousTouchPointPx.x) / this.pxPerDegrees;
|
|
float y = motionEvent2.getY();
|
|
PointF pointF = this.previousTouchPointPx;
|
|
float f3 = (y - pointF.y) / this.pxPerDegrees;
|
|
pointF.set(motionEvent2.getX(), motionEvent2.getY());
|
|
double d = this.roll;
|
|
float cos = (float) Math.cos(d);
|
|
float sin = (float) Math.sin(d);
|
|
PointF pointF2 = this.accumulatedTouchOffsetDegrees;
|
|
pointF2.x -= (cos * x) - (sin * f3);
|
|
float f4 = pointF2.y + (sin * x) + (cos * f3);
|
|
pointF2.y = f4;
|
|
pointF2.y = Math.max(-45.0f, Math.min(45.0f, f4));
|
|
this.listener.onScrollChange(this.accumulatedTouchOffsetDegrees);
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.GestureDetector.SimpleOnGestureListener, android.view.GestureDetector.OnGestureListener
|
|
public boolean onSingleTapUp(MotionEvent motionEvent) {
|
|
return this.listener.onSingleTapUp(motionEvent);
|
|
}
|
|
}
|