194 lines
5.8 KiB
Java
194 lines
5.8 KiB
Java
package androidx.core.view;
|
|
|
|
import android.os.Build;
|
|
import android.view.WindowInsetsAnimationController;
|
|
import androidx.annotation.FloatRange;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.core.graphics.Insets;
|
|
import c.d.b.a.a;
|
|
import com.google.android.material.shadow.ShadowDrawableWrapper;
|
|
public final class WindowInsetsAnimationControllerCompat {
|
|
private final Impl mImpl;
|
|
|
|
public static class Impl {
|
|
public void finish(boolean z2) {
|
|
}
|
|
|
|
public float getCurrentAlpha() {
|
|
return 0.0f;
|
|
}
|
|
|
|
@FloatRange(from = ShadowDrawableWrapper.COS_45, to = 1.0d)
|
|
public float getCurrentFraction() {
|
|
return 0.0f;
|
|
}
|
|
|
|
@NonNull
|
|
public Insets getCurrentInsets() {
|
|
return Insets.NONE;
|
|
}
|
|
|
|
@NonNull
|
|
public Insets getHiddenStateInsets() {
|
|
return Insets.NONE;
|
|
}
|
|
|
|
@NonNull
|
|
public Insets getShownStateInsets() {
|
|
return Insets.NONE;
|
|
}
|
|
|
|
public int getTypes() {
|
|
return 0;
|
|
}
|
|
|
|
public boolean isCancelled() {
|
|
return true;
|
|
}
|
|
|
|
public boolean isFinished() {
|
|
return false;
|
|
}
|
|
|
|
public boolean isReady() {
|
|
return false;
|
|
}
|
|
|
|
public void setInsetsAndAlpha(@Nullable Insets insets, @FloatRange(from = 0.0d, to = 1.0d) float f, @FloatRange(from = 0.0d, to = 1.0d) float f2) {
|
|
}
|
|
}
|
|
|
|
@RequiresApi(30)
|
|
public static class Impl30 extends Impl {
|
|
private final WindowInsetsAnimationController mController;
|
|
|
|
public Impl30(@NonNull WindowInsetsAnimationController windowInsetsAnimationController) {
|
|
this.mController = windowInsetsAnimationController;
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
public void finish(boolean z2) {
|
|
this.mController.finish(z2);
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
public float getCurrentAlpha() {
|
|
return this.mController.getCurrentAlpha();
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
public float getCurrentFraction() {
|
|
return this.mController.getCurrentFraction();
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
@NonNull
|
|
public Insets getCurrentInsets() {
|
|
return Insets.toCompatInsets(this.mController.getCurrentInsets());
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
@NonNull
|
|
public Insets getHiddenStateInsets() {
|
|
return Insets.toCompatInsets(this.mController.getHiddenStateInsets());
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
@NonNull
|
|
public Insets getShownStateInsets() {
|
|
return Insets.toCompatInsets(this.mController.getShownStateInsets());
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
public int getTypes() {
|
|
return this.mController.getTypes();
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
public boolean isCancelled() {
|
|
return this.mController.isCancelled();
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
public boolean isFinished() {
|
|
return this.mController.isFinished();
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
public boolean isReady() {
|
|
return this.mController.isReady();
|
|
}
|
|
|
|
@Override // androidx.core.view.WindowInsetsAnimationControllerCompat.Impl
|
|
public void setInsetsAndAlpha(@Nullable Insets insets, float f, float f2) {
|
|
this.mController.setInsetsAndAlpha(insets == null ? null : insets.toPlatformInsets(), f, f2);
|
|
}
|
|
}
|
|
|
|
public WindowInsetsAnimationControllerCompat() {
|
|
if (Build.VERSION.SDK_INT < 30) {
|
|
this.mImpl = new Impl();
|
|
return;
|
|
}
|
|
StringBuilder O = a.O("On API 30+, the constructor taking a ");
|
|
O.append(WindowInsetsAnimationController.class.getSimpleName());
|
|
O.append(" as parameter");
|
|
throw new UnsupportedOperationException(O.toString());
|
|
}
|
|
|
|
@RequiresApi(30)
|
|
public WindowInsetsAnimationControllerCompat(@NonNull WindowInsetsAnimationController windowInsetsAnimationController) {
|
|
this.mImpl = new Impl30(windowInsetsAnimationController);
|
|
}
|
|
|
|
public void finish(boolean z2) {
|
|
this.mImpl.finish(z2);
|
|
}
|
|
|
|
public float getCurrentAlpha() {
|
|
return this.mImpl.getCurrentAlpha();
|
|
}
|
|
|
|
@FloatRange(from = ShadowDrawableWrapper.COS_45, to = 1.0d)
|
|
public float getCurrentFraction() {
|
|
return this.mImpl.getCurrentFraction();
|
|
}
|
|
|
|
@NonNull
|
|
public Insets getCurrentInsets() {
|
|
return this.mImpl.getCurrentInsets();
|
|
}
|
|
|
|
@NonNull
|
|
public Insets getHiddenStateInsets() {
|
|
return this.mImpl.getHiddenStateInsets();
|
|
}
|
|
|
|
@NonNull
|
|
public Insets getShownStateInsets() {
|
|
return this.mImpl.getShownStateInsets();
|
|
}
|
|
|
|
public int getTypes() {
|
|
return this.mImpl.getTypes();
|
|
}
|
|
|
|
public boolean isCancelled() {
|
|
return this.mImpl.isCancelled();
|
|
}
|
|
|
|
public boolean isFinished() {
|
|
return this.mImpl.isFinished();
|
|
}
|
|
|
|
public boolean isReady() {
|
|
return !isFinished() && !isCancelled();
|
|
}
|
|
|
|
public void setInsetsAndAlpha(@Nullable Insets insets, @FloatRange(from = 0.0d, to = 1.0d) float f, @FloatRange(from = 0.0d, to = 1.0d) float f2) {
|
|
this.mImpl.setInsetsAndAlpha(insets, f, f2);
|
|
}
|
|
}
|