package com.bytedance.adsdk.ugeno.ef.fm;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import com.bytedance.adsdk.ugeno.ef.ajl.ro;
import com.bytedance.adsdk.ugeno.fm;
import com.bytedance.adsdk.ugeno.jnr;
import com.bytedance.adsdk.ugeno.ro.lb;
import com.bytedance.adsdk.ugeno.wsy.fm;
import com.bytedance.adsdk.ugeno.wsy.wu;
import com.bytedance.adsdk.ugeno.wsy.yz;

/* JADX INFO: loaded from: classes.dex */
public class fm extends ro {
    private int ex;

    /* JADX INFO: renamed from: kc, reason: collision with root package name */
    private boolean f6332kc;
    private int ky;
    private String lsa;
    private boolean oy;
    private String po;
    private String ucr;
    private String vod;
    private fm.C0020fm wjb;

    public fm(Context context) {
        super(context);
        this.po = "row";
    }

    private void yz() {
        if (TextUtils.isEmpty(this.ucr)) {
            return;
        }
        ((com.bytedance.adsdk.ugeno.ef.ajl.fm) this.jnr).setCompoundDrawables(null, null, null, null);
        if (!this.ucr.startsWith("local://")) {
            jnr.fm().ro().fm(this.f6374ef, this.ucr, new fm.InterfaceC0016fm() { // from class: com.bytedance.adsdk.ugeno.ef.fm.fm.1
                @Override // com.bytedance.adsdk.ugeno.fm.InterfaceC0016fm
                public void fm(final Bitmap bitmap) {
                    if (bitmap == null) {
                        return;
                    }
                    wu.fm(new Runnable() { // from class: com.bytedance.adsdk.ugeno.ef.fm.fm.1.1
                        @Override // java.lang.Runnable
                        public void run() {
                            fm.this.ro(new BitmapDrawable(((lb) fm.this).ro.getResources(), bitmap));
                        }
                    });
                }
            });
        } else {
            try {
                dsz(this.ucr.replace("local://", ""));
            } catch (Throwable unused) {
            }
        }
    }

    public void dsz(String str) {
        Context context = this.ro;
        ro(wu.fm(context, yz.ro(context, str)));
    }

    @Override // com.bytedance.adsdk.ugeno.ro.lb
    public void lz() {
        super.lz();
        if (this.oy) {
            ((com.bytedance.adsdk.ugeno.ef.ajl.fm) this.jnr).setTextColor(((ro) this).cyr);
        }
        if (this.f6332kc) {
            if (this.zh) {
                fm(this.zzn);
            } else {
                yz(this.xgn);
            }
        }
    }

    @Override // com.bytedance.adsdk.ugeno.ef.ajl.ro, com.bytedance.adsdk.ugeno.ro.lb
    public void ro() {
        super.ro();
        yz();
        ((com.bytedance.adsdk.ugeno.ef.ajl.fm) this.jnr).setGravity(17);
    }

    @Override // com.bytedance.adsdk.ugeno.ro.lb
    public void tzk() {
        super.tzk();
        if (this.oy) {
            ((com.bytedance.adsdk.ugeno.ef.ajl.fm) this.jnr).setTextColor(this.ky);
        }
        if (this.f6332kc) {
            if (this.zh) {
                fm(this.wjb);
            } else {
                yz(this.ex);
            }
        }
    }

    @Override // com.bytedance.adsdk.ugeno.ef.ajl.ro, com.bytedance.adsdk.ugeno.ro.lb
    public void fm(String str, String str2) {
        super.fm(str, str2);
        str.getClass();
        switch (str) {
            case "direction":
                this.po = str2;
                break;
            case "highlightTextColor":
            case "highlightedTextColor":
                this.ky = com.bytedance.adsdk.ugeno.wsy.fm.fm(str2);
                this.oy = true;
                break;
            case "image":
                this.ucr = str2;
                break;
            case "highlightImage":
                this.vod = str2;
                break;
            case "highlightBackgroundColor":
                if (com.bytedance.adsdk.ugeno.wsy.fm.lb(str2)) {
                    this.zh = true;
                    this.wjb = com.bytedance.adsdk.ugeno.wsy.fm.ro(str2);
                } else {
                    this.ex = com.bytedance.adsdk.ugeno.wsy.fm.fm(str2);
                    this.zh = false;
                }
                this.f6332kc = true;
                break;
            case "highlightBackgroundImage":
                this.lsa = str2;
                break;
        }
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    /* JADX WARN: Removed duplicated region for block: B:19:0x0037  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void ro(Drawable drawable) {
        byte b10;
        if (drawable == null) {
            return;
        }
        String str = this.po;
        switch (str.hashCode()) {
            case -1781065991:
                b10 = !str.equals("column_reverse") ? (byte) -1 : (byte) 2;
                break;
            case -1354837162:
                if (str.equals("column")) {
                    b10 = 1;
                    break;
                }
                break;
            case -207799939:
                if (str.equals("row_reverse")) {
                    b10 = 0;
                    break;
                }
                break;
            case 113114:
                if (str.equals("row")) {
                    b10 = 3;
                    break;
                }
                break;
        }
        if (b10 == 0) {
            ((com.bytedance.adsdk.ugeno.ef.ajl.fm) this.jnr).setCompoundDrawablesWithIntrinsicBounds((Drawable) null, (Drawable) null, drawable, (Drawable) null);
            return;
        }
        if (b10 == 1) {
            ((com.bytedance.adsdk.ugeno.ef.ajl.fm) this.jnr).setCompoundDrawablesWithIntrinsicBounds((Drawable) null, drawable, (Drawable) null, (Drawable) null);
        } else if (b10 != 2) {
            ((com.bytedance.adsdk.ugeno.ef.ajl.fm) this.jnr).setCompoundDrawablesWithIntrinsicBounds(drawable, (Drawable) null, (Drawable) null, (Drawable) null);
        } else {
            ((com.bytedance.adsdk.ugeno.ef.ajl.fm) this.jnr).setCompoundDrawablesWithIntrinsicBounds((Drawable) null, (Drawable) null, (Drawable) null, drawable);
        }
    }
}
