package com.seewo.factoryaging.sensor;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.cvte.vman.R;
import j.n;
import j.p0.d.r;
import java.util.LinkedHashMap;
import java.util.Map;

/* JADX INFO: compiled from: SensorFragment.kt */
/* JADX INFO: loaded from: classes.dex */
@n
public final class SensorFragment extends com.seewo.factoryaging.s0.d<d, c> implements d {
    private TextView b0;
    private TextView c0;
    private TextView d0;
    private TextView e0;
    private TextView f0;
    private TextView g0;
    private i.a.k.b h0;
    private View i0;
    public Map<Integer, View> j0 = new LinkedHashMap();

    @Override // g.h.a.c
    public View B0(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        r.f(layoutInflater, "inflater");
        View viewInflate = layoutInflater.inflate(R.layout.fragment_sensor, viewGroup);
        View viewFindViewById = viewInflate.findViewById(R.id.fl_sensor);
        r.e(viewFindViewById, "rootView.findViewById(R.id.fl_sensor)");
        this.i0 = viewFindViewById;
        com.seewo.factoryaging.e1.d dVar = com.seewo.factoryaging.e1.d.a;
        if (viewFindViewById != null) {
            dVar.c(viewFindViewById);
            return viewInflate;
        }
        r.t("mFlSensor");
        throw null;
    }

    @Override // com.seewo.factoryaging.sensor.d
    public void C(String str) {
        r.f(str, "co2Value");
        TextView textView = this.e0;
        if (textView != null) {
            textView.setText(g0(R.string.co2_value, str));
        } else {
            r.t("mCo2Value");
            throw null;
        }
    }

    @Override // com.seewo.factoryaging.s0.d, g.h.a.c
    public void E0() {
        super.E0();
        i.a.k.b bVar = this.h0;
        if (bVar != null) {
            bVar.dispose();
        }
        G1();
    }

    @Override // com.seewo.factoryaging.s0.d
    public void G1() {
        this.j0.clear();
    }

    @Override // com.seewo.factoryaging.s0.d
    public void J1(View view, Bundle bundle) {
        int i2;
        int i3;
        int i4;
        r.f(view, "view");
        super.J1(view, bundle);
        View viewFindViewById = view.findViewById(R.id.temperature);
        r.c(viewFindViewById);
        this.b0 = (TextView) viewFindViewById;
        int i5 = 8;
        ((LinearLayout) view.findViewById(R.id.row_temperature)).setVisibility(com.seewo.factoryaging.e1.f.a.r() ? 0 : 8);
        View viewFindViewById2 = view.findViewById(R.id.humidity);
        r.c(viewFindViewById2);
        this.c0 = (TextView) viewFindViewById2;
        ((LinearLayout) view.findViewById(R.id.row_humidity)).setVisibility(com.seewo.factoryaging.e1.f.a.l() ? 0 : 8);
        View viewFindViewById3 = view.findViewById(R.id.tv_air_quality);
        r.e(viewFindViewById3, "view.findViewById(R.id.tv_air_quality)");
        this.d0 = (TextView) viewFindViewById3;
        LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.row_pm_2_5);
        Context contextP = P();
        if (contextP != null && com.seewo.factoryaging.e1.f.a.z(contextP)) {
            i2 = 0;
        } else {
            Log.d("test", "no need show PM2.5");
            i2 = 8;
        }
        linearLayout.setVisibility(i2);
        View viewFindViewById4 = view.findViewById(R.id.tv_co2_value);
        r.e(viewFindViewById4, "view.findViewById(R.id.tv_co2_value)");
        this.e0 = (TextView) viewFindViewById4;
        LinearLayout linearLayout2 = (LinearLayout) view.findViewById(R.id.row_co2);
        Context contextP2 = P();
        if (contextP2 != null && com.seewo.factoryaging.e1.f.a.A(contextP2)) {
            i3 = 0;
        } else {
            Log.d("test", "no need show Co2");
            i3 = 8;
        }
        linearLayout2.setVisibility(i3);
        View viewFindViewById5 = view.findViewById(R.id.tv_colorTemperature_value);
        r.e(viewFindViewById5, "view.findViewById(R.id.tv_colorTemperature_value)");
        this.g0 = (TextView) viewFindViewById5;
        LinearLayout linearLayout3 = (LinearLayout) view.findViewById(R.id.row_colorTemperature);
        if (com.seewo.factoryaging.e1.f.a.i()) {
            i4 = 0;
        } else {
            Log.d("test", "no need show color temperature");
            i4 = 8;
        }
        linearLayout3.setVisibility(i4);
        View viewFindViewById6 = view.findViewById(R.id.tv_voc_value);
        r.e(viewFindViewById6, "view.findViewById(R.id.tv_voc_value)");
        this.f0 = (TextView) viewFindViewById6;
        LinearLayout linearLayout4 = (LinearLayout) view.findViewById(R.id.row_voc);
        if (P() != null && com.seewo.factoryaging.e1.f.a.B()) {
            i5 = 0;
        } else {
            Log.d("test", "no need show Co2");
        }
        linearLayout4.setVisibility(i5);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // com.seewo.factoryaging.s0.d
    /* JADX INFO: renamed from: K1, reason: merged with bridge method [inline-methods] */
    public c I1() {
        Context contextP = P();
        r.c(contextP);
        return new e(contextP);
    }

    @Override // com.seewo.factoryaging.s0.d, g.h.a.c
    public void V0(View view, Bundle bundle) {
        r.f(view, "view");
        super.V0(view, bundle);
        c cVarH1 = H1();
        r.c(cVarH1);
        cVarH1.l();
    }

    @Override // com.seewo.factoryaging.sensor.d
    public void c(String str) {
        r.f(str, "humidity");
        TextView textView = this.c0;
        if (textView != null) {
            textView.setText(str);
        } else {
            r.t("mHumidity");
            throw null;
        }
    }

    @Override // com.seewo.factoryaging.sensor.d
    public void g(String str) {
        r.f(str, "vocValue");
        TextView textView = this.f0;
        if (textView == null) {
            r.t("mVocValue");
            throw null;
        }
        textView.setText(str + " ppm");
    }

    @Override // com.seewo.factoryaging.sensor.d
    public void q(String str) {
        r.f(str, "colorTemperature");
        TextView textView = this.g0;
        if (textView != null) {
            textView.setText(str);
        } else {
            r.t("mColorTemperature");
            throw null;
        }
    }

    @Override // com.seewo.factoryaging.sensor.d
    public void r(String str) {
        r.f(str, "airQuality");
        TextView textView = this.d0;
        if (textView == null) {
            r.t("mAirQuality");
            throw null;
        }
        com.seewo.factoryaging.e1.d dVar = com.seewo.factoryaging.e1.d.a;
        String strG0 = g0(R.string.pm2_5_concentration, str);
        r.e(strG0, "getString(R.string.pm2_5…oncentration, airQuality)");
        textView.setText(dVar.g(strG0, "m3"));
    }

    @Override // com.seewo.factoryaging.sensor.d
    public void s() {
        String strF0 = f0(R.string.str_temperature_status_fail);
        r.e(strF0, "getString(R.string.str_temperature_status_fail)");
        TextView textView = this.b0;
        if (textView == null) {
            r.t("mTemperature");
            throw null;
        }
        textView.setText(strF0);
        TextView textView2 = this.c0;
        if (textView2 == null) {
            r.t("mHumidity");
            throw null;
        }
        textView2.setText(strF0);
        TextView textView3 = this.d0;
        if (textView3 == null) {
            r.t("mAirQuality");
            throw null;
        }
        textView3.setText(strF0);
        TextView textView4 = this.e0;
        if (textView4 != null) {
            textView4.setText(strF0);
        } else {
            r.t("mCo2Value");
            throw null;
        }
    }

    @Override // com.seewo.factoryaging.sensor.d
    public void w(String str) {
        r.f(str, "temperature");
        TextView textView = this.b0;
        if (textView != null) {
            textView.setText(str);
        } else {
            r.t("mTemperature");
            throw null;
        }
    }
}
