package xyz.netfly.mobile.player;

import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import tv.danmaku.ijk.media.player.ui.IjkVideoView;

/* JADX INFO: loaded from: classes3.dex */
public final class q extends com.bumptech.glide.request.target.c {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ t f35003c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public q(t tVar, int i10, int i11) {
        super(i10, i11);
        this.f35003c = tVar;
    }

    @Override // com.bumptech.glide.request.target.c, com.bumptech.glide.request.target.j
    public void onLoadCleared(@Nullable Drawable drawable) {
        IjkVideoView ijkVideoView;
        t tVar = this.f35003c;
        AppCompatActivity appCompatActivity = tVar.f35007a;
        if (appCompatActivity == null || appCompatActivity.isDestroyed() || tVar.f35007a.isFinishing() || (ijkVideoView = tVar.f35008b) == null || ijkVideoView.getPlaybackState() > 1) {
            return;
        }
        tVar.f35008b.setDrawableArtwork(drawable);
    }

    @Override // com.bumptech.glide.request.target.c, com.bumptech.glide.request.target.j
    public void onResourceReady(@NonNull Drawable drawable, @Nullable r5.c cVar) {
        IjkVideoView ijkVideoView;
        Bitmap bitmap;
        t tVar = this.f35003c;
        AppCompatActivity appCompatActivity = tVar.f35007a;
        if (appCompatActivity == null || appCompatActivity.isDestroyed() || tVar.f35007a.isFinishing() || (ijkVideoView = tVar.f35008b) == null || ijkVideoView.getPlaybackState() > 1) {
            return;
        }
        IjkVideoView ijkVideoView2 = tVar.f35008b;
        if ((drawable instanceof BitmapDrawable) && tVar.f35007a != null && (bitmap = ((BitmapDrawable) drawable).getBitmap()) != null && !bitmap.isRecycled()) {
            try {
                Bitmap bitmapCopy = bitmap.copy(bitmap.getConfig() != null ? bitmap.getConfig() : Bitmap.Config.ARGB_8888, false);
                if (bitmapCopy != null) {
                    drawable = new BitmapDrawable(tVar.f35007a.getResources(), bitmapCopy);
                }
            } catch (Exception unused) {
            }
        }
        ijkVideoView2.setDrawableArtwork(drawable);
    }
}
