package ke;

import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import ie.t2;
import org.drive_hunter.R;
import xyz.stream.api.entity.VideoEntity;
import xyz.stream.api.q;
import xyz.stream.view.CustomImageView;
import xyz.stream.view.SingleTypeAdapter;

/* JADX INFO: loaded from: classes3.dex */
public final class n extends SingleTypeAdapter {
    @Override // xyz.stream.view.SingleTypeAdapter
    public final v3.a createBinding(ViewGroup viewGroup) {
        return t2.inflate(LayoutInflater.from(viewGroup.getContext()), viewGroup, false);
    }

    @Override // xyz.stream.view.SingleTypeAdapter
    public final void onBindData(v3.a aVar, Object obj, int i10) {
        t2 t2Var = (t2) aVar;
        VideoEntity videoEntity = (VideoEntity) obj;
        ViewGroup.LayoutParams layoutParams = t2Var.f27497b.getLayoutParams();
        layoutParams.height = (int) TypedValue.applyDimension(1, 465.0f, this.context.getResources().getDisplayMetrics());
        t2Var.f27497b.setLayoutParams(layoutParams);
        CustomImageView customImageView = t2Var.f27498c;
        ViewGroup.LayoutParams layoutParams2 = customImageView.getLayoutParams();
        layoutParams2.height = (int) TypedValue.applyDimension(1, 465.0f, this.context.getResources().getDisplayMetrics());
        customImageView.setLayoutParams(layoutParams2);
        q qVarG = q.g();
        String videoPic = videoEntity.getVideoPic();
        qVarG.getClass();
        customImageView.load(CustomImageView.Request.image(q.f(videoPic)).radius(12).size(325, 472));
        t2Var.f27500e.setText(videoEntity.getTitle());
        xyz.stream.utils.e.d().getClass();
        boolean zEquals = xyz.stream.utils.e.e().equals("ar");
        LinearLayout linearLayout = t2Var.f27499d;
        if (zEquals) {
            linearLayout.setBackgroundResource(R.drawable.shape_radius_rating_right_mobile);
        }
        if (videoEntity.getVoteAverage() == null || videoEntity.getVoteAverage().isEmpty()) {
            return;
        }
        try {
            double d10 = Double.parseDouble(videoEntity.getVoteAverage());
            linearLayout.setVisibility(0);
            t2Var.f27501f.setText(String.format("%.1f", Double.valueOf(d10)));
        } catch (Exception e10) {
            xyz.stream.utils.h.c(e10.getMessage());
        }
    }
}
