package tv2; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.MutableContextWrapper; import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; import android.os.Message; import android.util.Log; import android.view.View; import android.widget.FrameLayout; import android.widget.LinearLayout; import com.alibaba.alibclinkpartner.linkpartner.constants.ALPParamConstant; import com.alibaba.baichuan.trade.biz.applink.adapter.AppLinkConstants; import com.meizu.cloud.pushsdk.notification.model.AdvanceSetting; import com.tencent.smtt.export.external.interfaces.IX5WebChromeClient; import com.tencent.smtt.export.external.interfaces.PermissionRequest; import com.tencent.smtt.sdk.ValueCallback; import com.tencent.smtt.sdk.WebChromeClient; import com.tencent.smtt.sdk.WebView; import com.tencent.smtt.sdk.WebViewClient; import com.xingin.android.xhscomm.router.Routers; import com.xingin.android.xhscomm.router.SimpleRouterCallback; import com.xingin.utils.core.XYUriUtils; import hv2.e; import java.util.ArrayList; import kotlin.Lazy; import kotlin.LazyKt__LazyJVMKt; import kotlin.Metadata; import kotlin.TypeCastException; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.Lambda; import kotlin.jvm.internal.PropertyReference1Impl; import kotlin.jvm.internal.Reflection; import kotlin.reflect.KProperty; import kotlin.text.StringsKt__StringsJVMKt; import lv2.f; @Metadata(bv = {}, d1 = {"\u0000\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0011\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u00012\u00020\u0002:\u0001\u001fB-\u0012\b\u00109\u001a\u0004\u0018\u000108\u0012\b\u0010:\u001a\u0004\u0018\u00010'\u0012\b\u0010<\u001a\u0004\u0018\u00010;\u0012\u0006\u0010>\u001a\u00020=¢\u0006\u0004\b?\u0010@J\u001a\u0010\b\u001a\u00020\u00072\u0006\u0010\u0004\u001a\u00020\u00032\b\u0010\u0006\u001a\u0004\u0018\u00010\u0005H\u0016J\u0018\u0010\u000b\u001a\u00020\u00072\u0006\u0010\u0004\u001a\u00020\u00032\u0006\u0010\n\u001a\u00020\tH\u0016J&\u0010\u0011\u001a\u00020\u00072\f\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\r0\f2\u0006\u0010\u000f\u001a\u00020\u00052\u0006\u0010\u0010\u001a\u00020\u0005H\u0016J.\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0012\u001a\u00020\u00032\u0012\u0010\u0014\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\r0\u00130\f2\b\u0010\u0016\u001a\u0004\u0018\u00010\u0015H\u0016J*\u0010\u001f\u001a\u00020\u00072\u0006\u0010\u001a\u001a\u00020\u00192\u0006\u0010\u001b\u001a\u00020\t2\u0006\u0010\u001c\u001a\u00020\t2\b\u0010\u001e\u001a\u0004\u0018\u00010\u001dH\u0016J*\u0010$\u001a\u00020\u00172\u0006\u0010\u0012\u001a\u00020\u00032\u0006\u0010 \u001a\u00020\u00172\u0006\u0010!\u001a\u00020\u00172\b\u0010#\u001a\u0004\u0018\u00010\"H\u0016J\u0012\u0010&\u001a\u00020\u00072\b\u0010%\u001a\u0004\u0018\u00010\u0003H\u0016J\u001c\u0010*\u001a\u00020\u00072\b\u0010\u0004\u001a\u0004\u0018\u00010'2\b\u0010)\u001a\u0004\u0018\u00010(H\u0016J\n\u0010,\u001a\u0004\u0018\u00010+H\u0016J$\u0010*\u001a\u00020\u00072\b\u0010%\u001a\u0004\u0018\u00010'2\u0006\u0010-\u001a\u00020\t2\b\u0010.\u001a\u0004\u0018\u00010(H\u0016J\b\u0010/\u001a\u00020\u0007H\u0016J\b\u00100\u001a\u00020\u0017H\u0002R$\u00102\u001a\u0004\u0018\u0001018\u0006@\u0006X\u000e¢\u0006\u0012\n\u0004\b2\u00103\u001a\u0004\b4\u00105\"\u0004\b6\u00107¨\u0006A"}, d2 = {"Ltv2/c;", "Lcom/tencent/smtt/sdk/WebChromeClient;", "Lhv2/e;", "Lcom/tencent/smtt/sdk/WebView;", qo2.a.COPY_LINK_TYPE_VIEW, "", "title", "", "onReceivedTitle", "", "newProgress", "onProgressChanged", "Lcom/tencent/smtt/sdk/ValueCallback;", "Landroid/net/Uri;", "uploadFile", "acceptType", "capture", "openFileChooser", "webView", "", "filePathCallback", "Lcom/tencent/smtt/sdk/WebChromeClient$FileChooserParams;", "fileChooserParams", "", "onShowFileChooser", "Landroid/content/Context;", "context", AppLinkConstants.REQUESTCODE, ALPParamConstant.RESULT_CODE, "Landroid/content/Intent;", "data", "a", "isDialog", "isUserGesture", "Landroid/os/Message;", "resultMsg", "onCreateWindow", "p0", "onCloseWindow", "Landroid/view/View;", "Lcom/tencent/smtt/export/external/interfaces/IX5WebChromeClient$CustomViewCallback;", "callback", "onShowCustomView", "Landroid/graphics/Bitmap;", "getDefaultVideoPoster", "p1", "p2", "onHideCustomView", "c", "Llv2/f;", "track", "Llv2/f;", "getTrack", "()Llv2/f;", "d", "(Llv2/f;)V", "Llv2/a;", "ixyWebActView", "xywebview", "Landroid/widget/LinearLayout;", "webview_contain", "Llv2/e;", "webViewFileChooser", "<init>", "(Llv2/a;Landroid/view/View;Landroid/widget/LinearLayout;Llv2/e;)V", "xywebview_library_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: XYX5WebChromeClient.kt */ public final class c extends WebChromeClient implements e { /* renamed from: i reason: collision with root package name */ public static final /* synthetic */ KProperty[] f135145i = {Reflection.property1(new PropertyReference1Impl(Reflection.getOrCreateKotlinClass(c.class), "webPermissionRequestProxy", "getWebPermissionRequestProxy()Lcom/xingin/xywebview/interfaces/IXYWebPermissionRequestProxy;"))}; /* renamed from: j reason: collision with root package name */ public static final a f135146j = new a(null); /* renamed from: a reason: collision with root package name */ public final FrameLayout.LayoutParams f135147a = new FrameLayout.LayoutParams(-1, -1); /* renamed from: b reason: collision with root package name */ public f f135148b; /* renamed from: c reason: collision with root package name */ public PermissionRequest f135149c; /* renamed from: d reason: collision with root package name */ public final Lazy f135150d = LazyKt__LazyJVMKt.lazy(new C2185c(this)); /* renamed from: e reason: collision with root package name */ public final lv2.a f135151e; /* renamed from: f reason: collision with root package name */ public View f135152f; /* renamed from: g reason: collision with root package name */ public LinearLayout f135153g; /* renamed from: h reason: collision with root package name */ public final lv2.e f135154h; @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\b\n\u0002\b\u0005\b\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0005\u0010\u0006R\u0014\u0010\u0003\u001a\u00020\u00028\u0002XT¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004¨\u0006\u0007"}, d2 = {"Ltv2/c$a;", "", "", "FILE_CHOOSER_RESULT_CODE", "I", "<init>", "()V", "xywebview_library_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: XYX5WebChromeClient.kt */ public static final class a { public a() { } public /* synthetic */ a(DefaultConstructorMarker defaultConstructorMarker) { this(); } } @Metadata(bv = {}, d1 = {"\u0000\u001d\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0016¨\u0006\b"}, d2 = {"tv2/c$b", "Lcom/tencent/smtt/sdk/WebViewClient;", "Lcom/tencent/smtt/sdk/WebView;", "webview", "", "url", "", "shouldOverrideUrlLoading", "xywebview_library_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: XYX5WebChromeClient.kt */ public static final class b extends WebViewClient { /* renamed from: b reason: collision with root package name */ public final /* synthetic */ Context f135155b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ WebView f135156c; @Metadata(bv = {}, d1 = {"\u0000\u001d\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u001c\u0010\u0007\u001a\u00020\u00062\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016¨\u0006\b"}, d2 = {"tv2/c$b$a", "Lcom/xingin/android/xhscomm/router/SimpleRouterCallback;", "Landroid/content/Context;", "context", "Landroid/net/Uri;", ALPParamConstant.URI, "", "notFound", "xywebview_library_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: XYX5WebChromeClient.kt */ public static final class a extends SimpleRouterCallback { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ b f135157a; /* renamed from: b reason: collision with root package name */ public final /* synthetic */ String f135158b; public a(b bVar, String str) { this.f135157a = bVar; this.f135158b = str; } @Override // com.xingin.android.xhscomm.router.SimpleRouterCallback, com.xingin.android.xhscomm.router.RouterCallback public void notFound(Context context, Uri uri) { Context context2 = this.f135157a.f135155b; Intrinsics.checkExpressionValueIsNotNull(context2, "realContext"); Uri parse = Uri.parse(this.f135158b); Intrinsics.checkExpressionValueIsNotNull(parse, "Uri.parse(url)"); XYUriUtils.e(context2, parse, true); } } public b(Context context, WebView webView) { this.f135155b = context; this.f135156c = webView; } @Override // com.tencent.smtt.sdk.WebViewClient public boolean shouldOverrideUrlLoading(WebView webView, String str) { Intrinsics.checkParameterIsNotNull(webView, "webview"); Intrinsics.checkParameterIsNotNull(str, "url"); Routers.build(str).open(this.f135155b, new a(this, str)); this.f135156c.destroy(); return true; } } @Metadata(bv = {}, d1 = {"\u0000\u0007\n\u0002\b\u0003*\u0001\u0000\u0010\u0001\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"tv2/c$c$a", "a", "()Ltv2/c$c$a;"}, k = 3, mv = {1, 4, 0}) /* renamed from: tv2.c$c reason: collision with other inner class name */ /* compiled from: XYX5WebChromeClient.kt */ public static final class C2185c extends Lambda implements Function0<a> { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ c f135159a; @Metadata(bv = {}, d1 = {"\u0000\u001d\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0019\u0010\u0004\u001a\f\u0012\u0006\u0012\u0004\u0018\u00010\u0003\u0018\u00010\u0002H\u0016¢\u0006\u0004\b\u0004\u0010\u0005J\u001f\u0010\b\u001a\u00020\u00072\u000e\u0010\u0006\u001a\n\u0012\u0004\u0012\u00020\u0003\u0018\u00010\u0002H\u0016¢\u0006\u0004\b\b\u0010\t¨\u0006\n"}, d2 = {"tv2/c$c$a", "Llv2/c;", "", "", "a", "()[Ljava/lang/String;", "granted", "", "b", "([Ljava/lang/String;)V", "xywebview_library_release"}, k = 1, mv = {1, 4, 0}) /* renamed from: tv2.c$c$a */ /* compiled from: XYX5WebChromeClient.kt */ public static final class a implements lv2.c { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ C2185c f135160a; /* JADX WARN: Incorrect args count in method signature: ()V */ public a(C2185c cVar) { this.f135160a = cVar; } @Override // lv2.c public String[] a() { String[] resources; PermissionRequest permissionRequest = this.f135160a.f135159a.f135149c; if (permissionRequest == null || (resources = permissionRequest.getResources()) == null) { return null; } ArrayList arrayList = new ArrayList(resources.length); for (String str : resources) { Intrinsics.checkExpressionValueIsNotNull(str, AdvanceSetting.NETWORK_TYPE); arrayList.add(lv2.b.a(str)); } ArrayList arrayList2 = new ArrayList(); for (Object obj : arrayList) { String str2 = (String) obj; if (!(str2 == null || (StringsKt__StringsJVMKt.isBlank(str2)))) { arrayList2.add(obj); } } Object[] array = arrayList2.toArray(new String[0]); if (array != null) { return (String[]) array; } throw new TypeCastException("null cannot be cast to non-null type kotlin.Array<T>"); } /* JADX WARNING: Removed duplicated region for block: B:10:0x0012 */ /* JADX WARNING: Removed duplicated region for block: B:13:0x0020 */ @Override // lv2.c public void b(String[] strArr) { boolean z14; if (strArr != null) { if (!(strArr.length == 0)) { z14 = false; if (!z14) { PermissionRequest permissionRequest = this.f135160a.f135159a.f135149c; if (permissionRequest != null) { permissionRequest.deny(); return; } return; } ArrayList arrayList = new ArrayList(strArr.length); for (String str : strArr) { arrayList.add(lv2.b.b(str)); } ArrayList arrayList2 = new ArrayList(); for (Object obj : arrayList) { String str2 = (String) obj; if (!(str2 == null || str2.length() == 0)) { arrayList2.add(obj); } } Object[] array = arrayList2.toArray(new String[0]); if (array != null) { String[] strArr2 = (String[]) array; PermissionRequest permissionRequest2 = this.f135160a.f135159a.f135149c; if (permissionRequest2 != null) { permissionRequest2.grant(strArr2); return; } return; } throw new TypeCastException("null cannot be cast to non-null type kotlin.Array<T>"); } } z14 = true; if (!z14) { } } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public C2185c(c cVar) { super(0); this.f135159a = cVar; } /* renamed from: a */ public final a invoke() { return new a(this); } } public c(lv2.a aVar, View view, LinearLayout linearLayout, lv2.e eVar) { Intrinsics.checkParameterIsNotNull(eVar, "webViewFileChooser"); this.f135151e = aVar; this.f135152f = view; this.f135153g = linearLayout; this.f135154h = eVar; } @Override // hv2.e public void a(Context context, int i10, int i14, Intent intent) { Intrinsics.checkParameterIsNotNull(context, "context"); lv2.e eVar = this.f135154h; if (eVar != null) { eVar.c(context, i10, i14, intent); } } public final boolean c() { return Build.VERSION.SDK_INT >= 21; } public final void d(f fVar) { this.f135148b = fVar; } @Override // com.tencent.smtt.sdk.WebChromeClient public Bitmap getDefaultVideoPoster() { Bitmap defaultVideoPoster = super.getDefaultVideoPoster(); if (defaultVideoPoster != null) { return defaultVideoPoster; } Bitmap createBitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); createBitmap.eraseColor(0); return createBitmap; } @Override // com.tencent.smtt.sdk.WebChromeClient public void onCloseWindow(WebView webView) { Activity activity; super.onCloseWindow(webView); lv2.a aVar = this.f135151e; if (aVar != null && (activity = aVar.getActivity()) != null) { activity.finish(); } } @Override // com.tencent.smtt.sdk.WebChromeClient public boolean onCreateWindow(WebView webView, boolean z14, boolean z15, Message message) { Intrinsics.checkParameterIsNotNull(webView, "webView"); lv2.e eVar = this.f135154h; if (eVar != null) { eVar.a(); } if (message != null) { Context context = webView.getContext(); if (context instanceof MutableContextWrapper) { context = ((MutableContextWrapper) context).getBaseContext(); } WebView webView2 = new WebView(context); Object obj = message.obj; if (obj instanceof WebView.WebViewTransport) { webView2.setWebViewClient(new b(context, webView2)); ((WebView.WebViewTransport) obj).setWebView(webView2); message.sendToTarget(); return true; } } return super.onCreateWindow(webView, z14, z15, message); } @Override // com.tencent.smtt.sdk.WebChromeClient public void onHideCustomView() { super.onHideCustomView(); } @Override // com.tencent.smtt.sdk.WebChromeClient public void onProgressChanged(WebView webView, int i10) { Intrinsics.checkParameterIsNotNull(webView, qo2.a.COPY_LINK_TYPE_VIEW); super.onProgressChanged(webView, i10); lv2.a aVar = this.f135151e; if (aVar != null) { aVar.progressChange(i10); } } @Override // com.tencent.smtt.sdk.WebChromeClient public void onReceivedTitle(WebView webView, String str) { Intrinsics.checkParameterIsNotNull(webView, qo2.a.COPY_LINK_TYPE_VIEW); super.onReceivedTitle(webView, str); if (str == null) { str = ""; } lv2.a aVar = this.f135151e; if (aVar != null) { aVar.changeTitleIfNeed(str); } f fVar = this.f135148b; if (fVar != null) { fVar.c(str, webView); } } @Override // com.tencent.smtt.sdk.WebChromeClient public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback customViewCallback) { super.onShowCustomView(view, customViewCallback); if (this.f135152f == null) { LinearLayout linearLayout = this.f135153g; if (linearLayout != null) { linearLayout.addView(view, this.f135147a); } this.f135152f = view; if (view != null) { view.setVisibility(8); } LinearLayout linearLayout2 = this.f135153g; if (linearLayout2 != null) { linearLayout2.setVisibility(0); } LinearLayout linearLayout3 = this.f135153g; if (linearLayout3 != null) { linearLayout3.bringToFront(); } } else if (customViewCallback != null) { customViewCallback.onCustomViewHidden(); } } @Override // com.tencent.smtt.sdk.WebChromeClient public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) { boolean z14; lv2.a aVar; Activity activity; Intrinsics.checkParameterIsNotNull(webView, "webView"); Intrinsics.checkParameterIsNotNull(valueCallback, "filePathCallback"); Log.d("UPFILE", "file chooser params:" + String.valueOf(fileChooserParams)); boolean isCaptureEnabled = (!c() || fileChooserParams == null) ? false : fileChooserParams.isCaptureEnabled(); if (c()) { if ((fileChooserParams != null ? fileChooserParams.getMode() : 0) == 1) { z14 = true; aVar = this.f135151e; if (aVar != null || (activity = aVar.getActivity()) == null) { return false; } lv2.e eVar = this.f135154h; if (eVar != null) { eVar.b(activity, valueCallback, null, isCaptureEnabled, z14, fileChooserParams != null ? fileChooserParams.getAcceptTypes() : null); } return true; } } z14 = false; aVar = this.f135151e; if (aVar != null) { } return false; } @Override // com.tencent.smtt.sdk.WebChromeClient public void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) { Activity activity; lv2.e eVar; Intrinsics.checkParameterIsNotNull(valueCallback, "uploadFile"); Intrinsics.checkParameterIsNotNull(str, "acceptType"); Intrinsics.checkParameterIsNotNull(str2, "capture"); lv2.a aVar = this.f135151e; if (aVar != null && (activity = aVar.getActivity()) != null && (eVar = this.f135154h) != null) { eVar.b(activity, null, valueCallback, false, false, null); } } @Override // com.tencent.smtt.sdk.WebChromeClient public void onShowCustomView(View view, int i10, IX5WebChromeClient.CustomViewCallback customViewCallback) { super.onShowCustomView(view, i10, customViewCallback); } }