package ve;

import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import ie.r0;
import java.util.Objects;
import xyz.netfly.ui.search.SearchTabletActivity;
import xyz.stream.view.input.InputView;
import xyz.stream.view.input.OnInputListener;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class i implements TextView.OnEditorActionListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f33869a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f33870b;

    public /* synthetic */ i(Object obj, int i10) {
        this.f33869a = i10;
        this.f33870b = obj;
    }

    @Override // android.widget.TextView.OnEditorActionListener
    public final boolean onEditorAction(TextView textView, int i10, KeyEvent keyEvent) {
        int i11 = this.f33869a;
        Object obj = this.f33870b;
        switch (i11) {
            case 0:
                p pVar = (p) obj;
                if (i10 != 3) {
                    pVar.getClass();
                } else if (!pVar.f33900q.f27075b.getText().toString().trim().isEmpty()) {
                    pVar.b(pVar.f33900q.f27075b.getText().toString());
                    InputMethodManager inputMethodManager = (InputMethodManager) ((AppCompatActivity) pVar.f33886c.get()).getSystemService("input_method");
                    if (inputMethodManager != null && pVar.f33886c.get() != null && ((AppCompatActivity) pVar.f33886c.get()).getCurrentFocus() != null) {
                        View currentFocus = ((AppCompatActivity) pVar.f33886c.get()).getCurrentFocus();
                        Objects.requireNonNull(currentFocus);
                        inputMethodManager.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
                    }
                    pVar.j();
                }
                break;
            case 1:
                SearchTabletActivity searchTabletActivity = (SearchTabletActivity) obj;
                int i12 = SearchTabletActivity.Q;
                if (i10 != 3) {
                    searchTabletActivity.getClass();
                } else {
                    String strTrim = ((r0) searchTabletActivity.binding).f27417f.getText().toString().trim();
                    if (!strTrim.equals(" ") && !strTrim.isEmpty()) {
                        searchTabletActivity.K(strTrim);
                    }
                }
                break;
            default:
                InputView inputView = (InputView) obj;
                if (i10 != 3) {
                    int i13 = InputView.f36507b0;
                    inputView.getClass();
                } else {
                    OnInputListener onInputListener = inputView.f36510b;
                    if (onInputListener != null) {
                        onInputListener.onDone(inputView.f36512d.inputPreview.getText().toString());
                    }
                }
                break;
        }
        return false;
    }
}
