mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 02:17:18 +01:00
45 lines
2.4 KiB
Java
45 lines
2.4 KiB
Java
package com.facebook.react.views.scroll;
|
|
|
|
import android.view.MotionEvent;
|
|
import android.view.VelocityTracker;
|
|
import kotlin.Metadata;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0000\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u000e\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0010R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u0010\b\u001a\u00020\u00072\u0006\u0010\u0006\u001a\u00020\u0007@BX\u0086\u000e¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR\u001e\u0010\u000b\u001a\u00020\u00072\u0006\u0010\u0006\u001a\u00020\u0007@BX\u0086\u000e¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\n¨\u0006\u0011"}, d2 = {"Lcom/facebook/react/views/scroll/VelocityHelper;", "", "<init>", "()V", "velocityTracker", "Landroid/view/VelocityTracker;", "value", "", "xVelocity", "getXVelocity", "()F", "yVelocity", "getYVelocity", "calculateVelocity", "", "ev", "Landroid/view/MotionEvent;", "ReactAndroid_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
|
|
/* loaded from: classes7.dex */
|
|
public final class VelocityHelper {
|
|
|
|
@Nullable
|
|
private VelocityTracker velocityTracker;
|
|
private float xVelocity;
|
|
private float yVelocity;
|
|
|
|
public final void calculateVelocity(@NotNull MotionEvent ev) {
|
|
ev.getClass();
|
|
if (this.velocityTracker == null) {
|
|
this.velocityTracker = VelocityTracker.obtain();
|
|
}
|
|
VelocityTracker velocityTracker = this.velocityTracker;
|
|
if (velocityTracker != null) {
|
|
velocityTracker.addMovement(ev);
|
|
int action = ev.getAction() & 255;
|
|
if (action == 1 || action == 3) {
|
|
velocityTracker.computeCurrentVelocity(1);
|
|
this.xVelocity = velocityTracker.getXVelocity();
|
|
this.yVelocity = velocityTracker.getYVelocity();
|
|
velocityTracker.recycle();
|
|
this.velocityTracker = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public final float getXVelocity() {
|
|
return this.xVelocity;
|
|
}
|
|
|
|
public final float getYVelocity() {
|
|
return this.yVelocity;
|
|
}
|
|
}
|