package com.bytedance.sdk.openadsdk.lG.YFl;

import android.graphics.Bitmap;
import android.text.TextUtils;
import android.widget.ImageView;
import com.bytedance.sdk.component.wN.eT;
import com.bytedance.sdk.component.wN.qsH;
import com.bytedance.sdk.component.wN.rkt;
import com.bytedance.sdk.openadsdk.NjR.AlY;
import com.bytedance.sdk.openadsdk.core.lG;
import com.bytedance.sdk.openadsdk.core.model.Wwa;
import com.bytedance.sdk.openadsdk.utils.GS;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.util.Map;
/* loaded from: classes2.dex */
public class YFl {

    /* renamed from: com.bytedance.sdk.openadsdk.lG.YFl.YFl$YFl  reason: collision with other inner class name */
    /* loaded from: classes2.dex */
    public interface InterfaceC0161YFl {
        void YFl(int i, String str, Throwable th);

        void YFl(String str, Sg sg);
    }

    public void YFl(com.bytedance.sdk.openadsdk.lG.YFl yFl, final InterfaceC0161YFl interfaceC0161YFl, int i, int i2, ImageView.ScaleType scaleType, String str, final int i3, Wwa wwa) {
        AlY.YFl(yFl.YFl).YFl(yFl.Sg).YFl(i).Sg(i2).wN(GS.AlY(lG.YFl())).AlY(GS.tN(lG.YFl())).Sg(str).YFl(Bitmap.Config.RGB_565).YFl(scaleType).YFl(!TextUtils.isEmpty(str)).YFl(new qsH() { // from class: com.bytedance.sdk.openadsdk.lG.YFl.YFl.2
            @Override // com.bytedance.sdk.component.wN.qsH
            public Bitmap YFl(Bitmap bitmap) {
                return i3 <= 0 ? bitmap : com.bytedance.sdk.component.adexpress.AlY.YFl.YFl(lG.YFl(), bitmap, i3);
            }
        }).YFl(new com.bytedance.sdk.openadsdk.NjR.Sg(wwa, yFl.YFl, new rkt() { // from class: com.bytedance.sdk.openadsdk.lG.YFl.YFl.1
            @Override // com.bytedance.sdk.component.wN.rkt
            public void YFl(eT eTVar) {
                YFl.this.YFl(eTVar, interfaceC0161YFl);
            }

            @Override // com.bytedance.sdk.component.wN.rkt
            public void YFl(int i4, String str2, Throwable th) {
                YFl.this.YFl(i4, str2, th, interfaceC0161YFl);
            }
        }));
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public void YFl(eT eTVar, InterfaceC0161YFl interfaceC0161YFl) {
        if (interfaceC0161YFl != null) {
            Object Sg = eTVar.Sg();
            int YFl = YFl(eTVar);
            if (Sg instanceof byte[]) {
                interfaceC0161YFl.YFl(eTVar.YFl(), new Sg((byte[]) Sg, YFl));
                return;
            }
            if (Sg instanceof Bitmap) {
                interfaceC0161YFl.YFl(eTVar.YFl(), new Sg((Bitmap) Sg, eTVar.tN() instanceof Bitmap ? (Bitmap) eTVar.tN() : null, YFl));
            } else {
                interfaceC0161YFl.YFl(0, "not bitmap or gif result!", null);
            }
        }
    }

    private int YFl(eT eTVar) {
        String str;
        Map<String, String> AlY = eTVar.AlY();
        if (AlY == null || (str = AlY.get(CampaignEx.JSON_KEY_IMAGE_SIZE)) == null || !(str instanceof Integer)) {
            return 0;
        }
        return ((Integer) str).intValue();
    }

    protected void YFl(int i, String str, Throwable th, InterfaceC0161YFl interfaceC0161YFl) {
        if (interfaceC0161YFl != null) {
            interfaceC0161YFl.YFl(i, str, th);
        }
    }
}
