package qe1; import android.app.Activity; import android.content.Context; import android.graphics.Rect; import android.os.IBinder; import android.os.ResultReceiver; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import com.google.android.gms.common.internal.ServiceSpecificExtraArgs; import com.xingin.utils.core.d; import com.xingin.utils.core.d1; import java.util.Objects; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; import y7.f; import z60.h; @Metadata(bv = {}, d1 = {"\u0000>\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\r\bÆ\u0002\u0018\u00002\u00020\u0001:\u0002\"\u0018B\t\b\u0002¢\u0006\u0004\b \u0010!J\u0010\u0010\u0005\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002J\u0018\u0010\b\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\u0006\u0010\u0007\u001a\u00020\u0006J\u0018\u0010\n\u001a\u00020\u00042\b\u0010\t\u001a\u0004\u0018\u00010\u00022\u0006\u0010\u0007\u001a\u00020\u0006J\u0010\u0010\u000b\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002J\u0018\u0010\u0010\u001a\u00020\u000f2\b\u0010\f\u001a\u0004\u0018\u00010\u00022\u0006\u0010\u000e\u001a\u00020\rJ\u0018\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u0012\u001a\u00020\u00112\b\u0010\u0014\u001a\u0004\u0018\u00010\u0013J\"\u0010\u0018\u001a\u00020\u00042\u0006\u0010\u0012\u001a\u00020\u00112\b\u0010\u0017\u001a\u0004\u0018\u00010\u00162\b\u0010\u0014\u001a\u0004\u0018\u00010\u0013J\u0016\u0010\u001a\u001a\u00020\u00042\u0006\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0019\u001a\u00020\rR$\u0010\u001c\u001a\u00020\u000f2\u0006\u0010\u001b\u001a\u00020\u000f8\u0006@BX\u000e¢\u0006\f\n\u0004\b\u001c\u0010\u001d\u001a\u0004\b\u001e\u0010\u001f¨\u0006#"}, d2 = {"Lqe1/c;", "", "Landroid/view/View;", "currentFocusView", "", "e", "Landroid/os/ResultReceiver;", "resultReceiver", f.f156778k, "targetView", "i", "j", "addCommentLayout", "", "touchY", "", h.f160753a, "Landroid/app/Activity;", "activity", "Lqe1/c$b;", "emotionPanelListener", "d", "Lqe1/c$a;", ServiceSpecificExtraArgs.CastExtraArgs.LISTENER, "b", "softInputMode", "k", "<set-?>", "isKeyboardShowing", "Z", "g", "()Z", "<init>", "()V", "a", "matrix_base_library_release"}, k = 1, mv = {1, 6, 0}) /* compiled from: InputMethodUtils.kt */ public final class c { /* renamed from: a reason: collision with root package name */ public static final c f121508a = new c(); /* renamed from: b reason: collision with root package name */ public static boolean f121509b; /* renamed from: c reason: collision with root package name */ public static int f121510c; /* renamed from: d reason: collision with root package name */ public static boolean f121511d; @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\bf\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H&J\b\u0010\u0004\u001a\u00020\u0002H&¨\u0006\u0005"}, d2 = {"Lqe1/c$a;", "", "", "a", "b", "matrix_base_library_release"}, k = 1, mv = {1, 6, 0}) /* compiled from: InputMethodUtils.kt */ public interface a { void a(); void b(); } @Metadata(bv = {}, d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\bf\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H&J\u0010\u0010\u0007\u001a\u00020\u00042\u0006\u0010\u0006\u001a\u00020\u0002H&¨\u0006\b"}, d2 = {"Lqe1/c$b;", "", "", "touchY", "", "M5", "height", "J6", "matrix_base_library_release"}, k = 1, mv = {1, 6, 0}) /* compiled from: InputMethodUtils.kt */ public interface b { void J6(int i10); void M5(int i10); } public static final void c(View view, b bVar, a aVar) { Rect rect = new Rect(); view.getWindowVisibleDisplayFrame(rect); int f14 = d1.f() - (rect.bottom - rect.top); if (f14 >= 0 || f121511d) { if (f14 >= f121510c / 2) { int b14 = f14 - d.b(); f121510c = b14; if (bVar != null) { bVar.J6(b14); } f121509b = true; if (aVar != null && f121510c > 0) { f121511d = true; aVar.a(); return; } return; } f121509b = false; if (aVar != null) { aVar.b(); } } } public final void b(Activity activity, a aVar, b bVar) { Intrinsics.checkNotNullParameter(activity, "activity"); View findViewById = activity.findViewById(16908290); Objects.requireNonNull(findViewById, "null cannot be cast to non-null type android.view.ViewGroup"); ViewGroup viewGroup = (ViewGroup) findViewById; View childAt = viewGroup.getChildAt(0); View view = viewGroup; if (childAt != null) { view = viewGroup.getChildAt(0); } if (view != null) { f121510c = 0; f121511d = false; ViewTreeObserver viewTreeObserver = view.getViewTreeObserver(); if (viewTreeObserver != null) { viewTreeObserver.addOnGlobalLayoutListener(new b(view, bVar, aVar)); } } } public final void d(Activity activity, b bVar) { Intrinsics.checkNotNullParameter(activity, "activity"); a aVar = new a(activity); aVar.a(bVar); activity.addContentView(aVar, new ViewGroup.LayoutParams(-1, -1)); } public final void e(View view) { IBinder windowToken; InputMethodManager inputMethodManager; if (view != null && (windowToken = view.getWindowToken()) != null && (inputMethodManager = (InputMethodManager) view.getContext().getSystemService("input_method")) != null) { inputMethodManager.hideSoftInputFromWindow(windowToken, 0); } } public final void f(View view, ResultReceiver resultReceiver) { IBinder windowToken; InputMethodManager inputMethodManager; Intrinsics.checkNotNullParameter(resultReceiver, "resultReceiver"); if (view != null && (windowToken = view.getWindowToken()) != null && (inputMethodManager = (InputMethodManager) view.getContext().getSystemService("input_method")) != null) { inputMethodManager.hideSoftInputFromWindow(windowToken, 0, resultReceiver); } } public final boolean g() { return f121509b; } public final boolean h(View view, int i10) { if (view == null) { return false; } int[] iArr = new int[2]; view.getLocationOnScreen(iArr); if (i10 - (iArr[1] - d.b()) <= 0) { return true; } return false; } public final void i(View view, ResultReceiver resultReceiver) { Intrinsics.checkNotNullParameter(resultReceiver, "resultReceiver"); if (view != null) { Context context = view.getContext(); InputMethodManager inputMethodManager = (InputMethodManager) (context != null ? context.getSystemService("input_method") : null); if (inputMethodManager != null) { inputMethodManager.showSoftInput(view, 2, resultReceiver); } } } public final void j(View view) { if (view != null) { Context context = view.getContext(); InputMethodManager inputMethodManager = (InputMethodManager) (context != null ? context.getSystemService("input_method") : null); if (inputMethodManager != null) { inputMethodManager.toggleSoftInput(2, 1); } } } public final void k(Activity activity, int i10) { Intrinsics.checkNotNullParameter(activity, "activity"); if (!activity.isFinishing()) { WindowManager.LayoutParams attributes = activity.getWindow().getAttributes(); if (attributes.softInputMode != i10) { attributes.softInputMode = i10; activity.getWindow().setAttributes(attributes); } } } }