package nf;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.android.material.textfield.c;
import ie.u0;
import kotlinx.coroutines.y;
import oe.d;
import org.drive_hunter.R;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import xyz.stream.api.entity.RoleEntity;
import xyz.stream.api.o;
import xyz.stream.utils.e;
import xyz.stream.utils.e0;
import xyz.stream.utils.entity.CheckResultEntity;
import xyz.stream.utils.event.CheckEvent;
import xyz.stream.utils.event.RemainingDayEvent;
import xyz.stream.utils.f0;
import xyz.stream.view.BaseFragment;
import xyz.stream.view.BaseViewModel;
import xyz.stream.view.UiUtils;

/* JADX INFO: loaded from: classes3.dex */
public class b extends BaseFragment<BaseViewModel, u0> {
    public static final /* synthetic */ int E0 = 0;

    @Override // xyz.stream.view.BaseFragment
    public final void focus() {
        ((u0) this.binding).f27517h.requestFocus();
    }

    @Override // xyz.stream.view.BaseFragment
    public final v3.a getViewBinding(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        return u0.inflate(layoutInflater, viewGroup, false);
    }

    @Override // xyz.stream.view.BaseFragment
    public final void initData() {
        o.f().c();
    }

    @Override // xyz.stream.view.BaseFragment
    public final void initListener() {
        ((u0) this.binding).f27512c.setOnFocusChangeListener(new c(this, 7));
        ((u0) this.binding).f27512c.setOnClickListener(new com.google.android.material.textfield.b(this, 26));
        ((u0) this.binding).f27517h.setOnClickListener(new a());
        ((u0) this.binding).f27517h.setOnKeyListener(new d(this, 8));
    }

    @Override // xyz.stream.view.BaseFragment
    public final void initView() {
        y.S("UserPage");
        ((u0) this.binding).f27514e.f27536c.setText(getString(R.string.my));
        if (e.d().f36119h) {
            UiUtils.setUnFocusable(((u0) this.binding).f27517h);
            UiUtils.setUnFocusable(((u0) this.binding).f27512c);
            ((u0) this.binding).f27517h.setBackgroundResource(R.drawable.shape_login_select);
            TextView textView = ((u0) this.binding).f27517h;
            Context contextRequireContext = requireContext();
            Object obj = g0.d.f26125a;
            textView.setTextColor(contextRequireContext.getColor(R.color.main_text));
        }
        ((u0) this.binding).f27513d.setVisibility(0);
        ((u0) this.binding).f27519j.setVisibility(0);
        String strQ = f0.o().q("flutter.spUnid", "");
        ((u0) this.binding).f27519j.setText(strQ);
        CheckResultEntity checkResultEntityC = e.d().c();
        if (checkResultEntityC != null) {
            ((u0) this.binding).f27518i.setText((checkResultEntityC.getProductName() == null || checkResultEntityC.getProductName().isEmpty()) ? getString(R.string.free_trial) : checkResultEntityC.getProductName());
            ((u0) this.binding).f27515f.setText(checkResultEntityC.getUsername());
            ((u0) this.binding).f27516g.setText(checkResultEntityC.getExpired() != null ? checkResultEntityC.getExpired() : "");
        } else {
            ((u0) this.binding).f27518i.setText(getString(R.string.free_trial));
        }
        RoleEntity roleEntity = (RoleEntity) f0.o().k(RoleEntity.class, "flutter.role_entity");
        if (roleEntity != null) {
            ((u0) this.binding).f27520k.setText(roleEntity.getName());
            ((u0) this.binding).f27511b.setImageResource(y.r(roleEntity.getAvatarId()));
        } else {
            ((u0) this.binding).f27511b.setImageResource(y.s());
            ((u0) this.binding).f27520k.setText(strQ);
        }
    }

    @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
    public void onMessageEvent(CheckEvent checkEvent) {
        fe.d.b().k(checkEvent);
        String strQ = f0.o().q("flutter.spUnid", "");
        ((u0) this.binding).f27519j.setText(strQ);
        RoleEntity roleEntity = (RoleEntity) f0.o().k(RoleEntity.class, "flutter.role_entity");
        if (roleEntity != null) {
            ((u0) this.binding).f27520k.setText(roleEntity.getName());
            ((u0) this.binding).f27511b.setImageResource(y.r(roleEntity.getAvatarId()));
        } else {
            ((u0) this.binding).f27511b.setImageResource(y.s());
            ((u0) this.binding).f27520k.setText(strQ);
        }
        e0.m().p(requireActivity());
        CheckResultEntity checkResultEntity = checkEvent.checkResultEntity;
        if (checkResultEntity != null) {
            ((u0) this.binding).f27518i.setText((checkResultEntity.getProductName() == null || checkResultEntity.getProductName().isEmpty()) ? getString(R.string.free_trial) : checkResultEntity.getProductName());
            ((u0) this.binding).f27516g.setText(checkResultEntity.getExpired() != null ? checkResultEntity.getExpired() : "");
            ((u0) this.binding).f27515f.setText(checkResultEntity.getUsername());
        }
    }

    @Override // androidx.fragment.app.e0
    public final void onStart() {
        super.onStart();
        fe.d.b().j(this);
    }

    @Override // androidx.fragment.app.e0
    public final void onStop() {
        super.onStop();
        fe.d.b().m(this);
    }

    @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
    public void onMessageEvent(RemainingDayEvent remainingDayEvent) {
        fe.d.b().k(remainingDayEvent);
    }
}
