what-the-bank/sources/io/flutter/embedding/android/DrawableSplashScreen.java

98 lines
3.7 KiB
Java

package io.flutter.embedding.android;
import android.animation.Animator;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
@Deprecated
/* loaded from: classes5.dex */
public final class DrawableSplashScreen implements SplashScreen {
private final long crossfadeDurationInMillis;
private final Drawable drawable;
private final ImageView.ScaleType scaleType;
private DrawableSplashScreenView splashView;
public DrawableSplashScreen(Drawable drawable) {
this(drawable, ImageView.ScaleType.FIT_XY, 500L);
}
public DrawableSplashScreen(Drawable drawable, ImageView.ScaleType scaleType, long j) {
this.drawable = drawable;
this.scaleType = scaleType;
this.crossfadeDurationInMillis = j;
}
@Override // io.flutter.embedding.android.SplashScreen
public final View createSplashView(Context context, Bundle bundle) {
DrawableSplashScreenView drawableSplashScreenView = new DrawableSplashScreenView(context);
this.splashView = drawableSplashScreenView;
drawableSplashScreenView.setSplashDrawable(this.drawable, this.scaleType);
return this.splashView;
}
@Override // io.flutter.embedding.android.SplashScreen
public final void transitionToFlutter(Runnable runnable) {
DrawableSplashScreenView drawableSplashScreenView = this.splashView;
if (drawableSplashScreenView == null) {
runnable.run();
} else {
drawableSplashScreenView.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(this.crossfadeDurationInMillis).setListener(new Animator.AnimatorListener(this, runnable) { // from class: io.flutter.embedding.android.DrawableSplashScreen.1
final DrawableSplashScreen this$0;
final Runnable val$onTransitionComplete;
@Override // android.animation.Animator.AnimatorListener
public void onAnimationRepeat(Animator animator) {
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationStart(Animator animator) {
}
{
this.this$0 = this;
this.val$onTransitionComplete = runnable;
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationEnd(Animator animator) {
this.val$onTransitionComplete.run();
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationCancel(Animator animator) {
this.val$onTransitionComplete.run();
}
});
}
}
/* loaded from: classes5.dex */
public static class DrawableSplashScreenView extends ImageView {
public DrawableSplashScreenView(Context context) {
this(context, null, 0);
}
public DrawableSplashScreenView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public DrawableSplashScreenView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
public void setSplashDrawable(Drawable drawable) {
setSplashDrawable(drawable, ImageView.ScaleType.FIT_XY);
}
public void setSplashDrawable(Drawable drawable, ImageView.ScaleType scaleType) {
setScaleType(scaleType);
setImageDrawable(drawable);
}
}
}