package p037.p091.p095;

import android.util.Pair;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import java.util.ArrayList;
import p037.p091.p092.C2084;
import p037.p091.p095.C2141;
import p037.p091.p095.C2155;

/* JADX INFO: renamed from: މ.މ.ލ.މ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2151 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public ArrayList<Pair<C2141, C2141>> f7016 = new ArrayList<>();

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public boolean f7017;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public C2141.InterfaceC2149 f7018;

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m4203(View view) {
        if (this.f7017) {
            this.f7017 = false;
            ((InputMethodManager) view.getContext().getSystemService("input_method")).hideSoftInputFromWindow(view.getWindowToken(), 0);
            C2084.this.m4061(false);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:53:0x00cd  */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void m4204(C2141 c2141, TextView textView) {
        C2151 c2151;
        C2151 c21512;
        int i;
        C2155.C2160 c2160M4193 = c2141.m4193(textView);
        m4206(c2160M4193, textView);
        C2141.InterfaceC2148 interfaceC2148 = c2141.f7001;
        if (interfaceC2148 != null) {
            interfaceC2148.mo4066(c2160M4193.f7050);
        }
        long jMo2034 = C2084.this.mo2034(c2160M4193.f7050);
        c2141.f7002.m4220(c2160M4193, false, true);
        if (jMo2034 != -3) {
            C2138 c2138 = c2160M4193.f7050;
            if (jMo2034 == c2138.f6867) {
                c2151 = this;
            } else {
                if (jMo2034 == -2) {
                    int iIndexOf = c2141.f7000.indexOf(c2138);
                    if (iIndexOf >= 0) {
                        i = iIndexOf + 1;
                        c21512 = this;
                        c2151 = c21512;
                    }
                    c2151 = this;
                } else {
                    c2151 = this;
                    c21512 = this;
                    i = 0;
                }
                while (true) {
                    int size = c2141.f7000.size();
                    if (jMo2034 == -2) {
                        while (i < size) {
                            if ((c2141.f7000.get(i).f6972 & 32) == 32) {
                                break;
                            } else {
                                i++;
                            }
                        }
                    } else {
                        while (i < size && c2141.f7000.get(i).f6867 != jMo2034) {
                            i++;
                        }
                    }
                    if (i < size) {
                        C2155.C2160 c2160 = (C2155.C2160) c2141.f7002.f7022.m553(i);
                        if (c2160 != null) {
                            int i2 = c2160.f7050.f6975;
                            if (i2 == 1 || i2 == 2) {
                                c21512.m4205(c2141, c2160);
                            } else {
                                c21512.m4203(c2160.f1326);
                                c2160.f1326.requestFocus();
                            }
                            z = true;
                        }
                    } else {
                        int i3 = 0;
                        while (true) {
                            if (i3 >= c21512.f7016.size()) {
                                c2141 = null;
                                break;
                            }
                            Pair<C2141, C2141> pair = c21512.f7016.get(i3);
                            if (pair.first == c2141) {
                                c2141 = (C2141) pair.second;
                                break;
                            }
                            i3++;
                        }
                        if (c2141 == null) {
                            break;
                        }
                        c2151 = c2151;
                        c21512 = c21512;
                        i = 0;
                    }
                }
            }
        }
        if (z) {
            return;
        }
        c2151.m4203(textView);
        c2160M4193.f1326.requestFocus();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m4205(C2141 c2141, C2155.C2160 c2160) {
        c2141.f7002.m4220(c2160, true, true);
        int i = c2160.f7057;
        View view = i != 1 ? i != 2 ? i != 3 ? null : c2160.f7053 : c2160.f7052 : c2160.f7051;
        if (view != null) {
            int i2 = c2160.f7057;
            if (i2 == 1 || i2 == 2) {
                InputMethodManager inputMethodManager = (InputMethodManager) view.getContext().getSystemService("input_method");
                view.setFocusable(true);
                view.requestFocus();
                inputMethodManager.showSoftInput(view, 0);
                if (this.f7017) {
                    return;
                }
                this.f7017 = true;
                C2084.this.m4061(true);
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m4206(C2155.C2160 c2160, TextView textView) {
        C2138 c2138 = c2160.f7050;
        if (textView == c2160.f7052) {
            if (c2138.f6974 != null) {
                c2138.f6974 = textView.getText();
                return;
            } else {
                c2138.f6870 = textView.getText();
                return;
            }
        }
        if (textView == c2160.f7051) {
            if (c2138.f6973 != null) {
                c2138.f6973 = textView.getText();
            } else {
                c2138.f6869 = textView.getText();
            }
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public void m4207(C2141 c2141, TextView textView) {
        C2155.C2160 c2160M4193 = c2141.m4193(textView);
        m4206(c2160M4193, textView);
        if (C2084.this == null) {
            throw null;
        }
        c2141.f7002.m4220(c2160M4193, false, true);
        m4203(textView);
        c2160M4193.f1326.requestFocus();
    }
}
