package com.ss.android.ugc.aweme.im.sdk.common.ui.widget;

import X.C2088IsZ;
import X.M12;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.im.sdk.share.viewmodel.ShareDialogViewModel;

public final class MTSearchHead$4 implements TextWatcher {
    public final /* synthetic */ C2088IsZ LIZ;

    static {
        Covode.recordClassIndex(86327);
    }

    public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        M12.LIZ(charSequence);
    }

    public MTSearchHead$4(C2088IsZ isZ) {
        this.LIZ = isZ;
    }

    public final void afterTextChanged(Editable editable) {
        String str;
        if (editable != null) {
            str = editable.toString();
        } else {
            str = null;
        }
        if (str == null || str.length() == 0) {
            ShareDialogViewModel shareDialogViewModel = this.LIZ.LIZJ;
            if (shareDialogViewModel != null) {
                shareDialogViewModel.LIZ(0);
            }
            ShareDialogViewModel shareDialogViewModel2 = this.LIZ.LIZJ;
            if (shareDialogViewModel2 != null) {
                shareDialogViewModel2.LJ();
                return;
            }
            return;
        }
        ShareDialogViewModel shareDialogViewModel3 = this.LIZ.LIZJ;
        if (shareDialogViewModel3 != null) {
            shareDialogViewModel3.LIZ(1);
        }
        ShareDialogViewModel shareDialogViewModel4 = this.LIZ.LIZJ;
        if (shareDialogViewModel4 != null) {
            M12.LIZ(str);
            shareDialogViewModel4.LJIIIIZZ.LIZ(str);
        }
    }

    public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        M12.LIZ(charSequence);
        if (!TextUtils.isEmpty(charSequence) && this.LIZ.LIZIZ.getVisibility() == 8) {
            this.LIZ.LIZIZ.setVisibility(0);
        } else if (TextUtils.isEmpty(charSequence) && this.LIZ.LIZIZ.getVisibility() == 0) {
            this.LIZ.LIZIZ.setVisibility(8);
        }
    }
}
