- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
133 lines
3.4 KiB
Java
133 lines
3.4 KiB
Java
package androidx.core.widget;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Canvas;
|
|
import android.os.Build;
|
|
import android.util.AttributeSet;
|
|
import android.widget.EdgeEffect;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RequiresApi;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class EdgeEffectCompat {
|
|
private final EdgeEffect mEdgeEffect;
|
|
|
|
@Deprecated
|
|
public EdgeEffectCompat(Context context) {
|
|
this.mEdgeEffect = new EdgeEffect(context);
|
|
}
|
|
|
|
@NonNull
|
|
public static EdgeEffect create(@NonNull Context context, @Nullable AttributeSet attributeSet) {
|
|
if (Build.VERSION.SDK_INT >= 31) {
|
|
return Api31Impl.create(context, attributeSet);
|
|
}
|
|
return new EdgeEffect(context);
|
|
}
|
|
|
|
public static float getDistance(@NonNull EdgeEffect edgeEffect) {
|
|
if (Build.VERSION.SDK_INT >= 31) {
|
|
return Api31Impl.getDistance(edgeEffect);
|
|
}
|
|
return 0.0f;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setSize(int i, int i2) {
|
|
this.mEdgeEffect.setSize(i, i2);
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean isFinished() {
|
|
return this.mEdgeEffect.isFinished();
|
|
}
|
|
|
|
@Deprecated
|
|
public void finish() {
|
|
this.mEdgeEffect.finish();
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean onPull(float f) {
|
|
this.mEdgeEffect.onPull(f);
|
|
return true;
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean onPull(float f, float f2) {
|
|
onPull(this.mEdgeEffect, f, f2);
|
|
return true;
|
|
}
|
|
|
|
public static void onPull(@NonNull EdgeEffect edgeEffect, float f, float f2) {
|
|
Api21Impl.onPull(edgeEffect, f, f2);
|
|
}
|
|
|
|
public static float onPullDistance(@NonNull EdgeEffect edgeEffect, float f, float f2) {
|
|
if (Build.VERSION.SDK_INT >= 31) {
|
|
return Api31Impl.onPullDistance(edgeEffect, f, f2);
|
|
}
|
|
onPull(edgeEffect, f, f2);
|
|
return f;
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean onRelease() {
|
|
this.mEdgeEffect.onRelease();
|
|
return this.mEdgeEffect.isFinished();
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean onAbsorb(int i) {
|
|
this.mEdgeEffect.onAbsorb(i);
|
|
return true;
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean draw(Canvas canvas) {
|
|
return this.mEdgeEffect.draw(canvas);
|
|
}
|
|
|
|
@RequiresApi(31)
|
|
public static class Api31Impl {
|
|
private Api31Impl() {
|
|
}
|
|
|
|
public static EdgeEffect create(Context context, AttributeSet attributeSet) {
|
|
try {
|
|
return new EdgeEffect(context, attributeSet);
|
|
} catch (Throwable unused) {
|
|
return new EdgeEffect(context);
|
|
}
|
|
}
|
|
|
|
public static float onPullDistance(EdgeEffect edgeEffect, float f, float f2) {
|
|
try {
|
|
return edgeEffect.onPullDistance(f, f2);
|
|
} catch (Throwable unused) {
|
|
edgeEffect.onPull(f, f2);
|
|
return 0.0f;
|
|
}
|
|
}
|
|
|
|
public static float getDistance(EdgeEffect edgeEffect) {
|
|
try {
|
|
return edgeEffect.getDistance();
|
|
} catch (Throwable unused) {
|
|
return 0.0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
@RequiresApi(21)
|
|
public static class Api21Impl {
|
|
private Api21Impl() {
|
|
}
|
|
|
|
public static void onPull(EdgeEffect edgeEffect, float f, float f2) {
|
|
edgeEffect.onPull(f, f2);
|
|
}
|
|
}
|
|
}
|