package com.ifpdos.videopresenter.view.gestureview;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.TextureView;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.ifpdos.autotest.R;

/* JADX INFO: loaded from: classes.dex */
public class ImageRoom extends FrameLayout {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private Context f2419c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private int f2420d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private ImageView f2421e;

    public ImageRoom(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f2420d = -1;
        this.f2419c = context;
        c();
    }

    private void b() {
        b bVar = new b(this.f2419c);
        this.f2421e = bVar;
        bVar.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
    }

    private void c() {
        b();
        a();
        setWillNotDraw(false);
    }

    private void d(Bitmap bitmap) {
        if (bitmap == null) {
            this.f2421e.setScaleType(ImageView.ScaleType.CENTER_CROP);
            this.f2421e.setImageResource(R.drawable.img_default);
        } else {
            this.f2421e.setScaleType(ImageView.ScaleType.FIT_CENTER);
            this.f2421e.setImageBitmap(bitmap);
        }
    }

    public void a() {
        TextureView textureView = new TextureView(this.f2419c);
        textureView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        if (textureView.getParent() == null) {
            addView(textureView);
        }
        if (this.f2421e.getParent() == null) {
            addView(this.f2421e);
        }
    }

    public void e(String str) {
        d(TextUtils.isEmpty(str) ? null : BitmapFactory.decodeFile(str));
    }

    public void setIndex(int i) {
        this.f2420d = i;
    }
}
