导航菜单

页面标题

页面副标题

Your TV v2.0.2 - w4.java 源代码

正在查看: Your TV v2.0.2 应用的 w4.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package G0;

import android.R;
import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.media3.common.MimeTypes;
import androidx.media3.exoplayer.ExoPlayer;
import com.horsenma.yourtv.MainActivity;
import com.horsenma.yourtv.YourTVApplication;
import com.horsenma.yourtv.data.TV;
import com.tencent.smtt.export.external.interfaces.WebResourceResponse;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
import fi.iki.elonen.NanoHTTPD;
import java.io.ByteArrayInputStream;
import java.util.List;
import java.util.Map;

public final class w4 extends androidx.fragment.app.H {

    public ViewGroup f1482a;

    public I0.i f1483b;

    public final Handler f1484c;

    public AppCompatImageView f1485d;

    public ProgressBar f1486e;

    public int f1487f;

    public boolean f1488g;

    public boolean f1489h;

    public String f1490i;

    public long f1491j;

    public final long f1492k;

    public w4() {
        Looper myLooper = Looper.myLooper();
        kotlin.jvm.internal.j.b(myLooper);
        this.f1484c = new Handler(myLooper);
        this.f1492k = ExoPlayer.DEFAULT_DETACH_SURFACE_TIMEOUT_MS;
    }

    public static final void g(w4 w4Var) {
        ViewGroup viewGroup = w4Var.f1482a;
        if (viewGroup instanceof WebView) {
            kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type com.tencent.smtt.sdk.WebView");
            ((WebView) viewGroup).evaluateJavascript("        (function() {\n    function adjustFullscreen() {\n        // 设置 body 样式,确保全屏覆盖\n        const body = document.body;\n        if (body) {\n            body.style.left = '0';\n            body.style.width = '100vw';\n            body.style.height = '100vh';\n            body.style.position = 'fixed';\n            body.style.overflow = 'hidden';\n        }\n\n        // 处理 video 元素\n        const video = document.querySelector('video');\n        if (video) {\n            video.style.position = 'fixed';\n            video.style.top = '0';\n            video.style.left = '0';\n            video.style.zIndex = '9999';\n            // 兼容低版本 Android\n            if (navigator.userAgent.includes('Android') && /Version\\/[4-8]\\./.test(navigator.userAgent)) {\n                video.style.width = '100%';\n                video.style.height = '100%';\n            } else {\n                video.style.objectFit = 'fill';\n                video.style.width = '100vw';\n                video.style.height = '100vh';\n            }\n            // 尝试自动播放\n            video.setAttribute('autoplay', 'true');\n            video.setAttribute('muted', 'true'); // 静音以绕过某些浏览器限制\n            try {\n                video.play();\n                console.log('Video play success');\n            } catch (e) {\n                console.log('Video play error: ' + e.message);\n            }\n            return true;\n        }\n\n        // 处理 iframe 元素\n        const iframe = document.querySelector('iframe');\n        if (iframe && iframe.src && !iframe.hidden) {\n            iframe.style.position = 'fixed';\n            iframe.style.top = '0';\n            iframe.style.left = '0';\n            iframe.style.zIndex = '9999';\n            // 兼容低版本 Android\n            if (navigator.userAgent.includes('Android') && /Version\\/[4-8]\\./.test(navigator.userAgent)) {\n                iframe.style.width = '100%';\n                iframe.style.height = '100%';\n            } else {\n                iframe.style.objectFit = 'fill';\n                iframe.style.width = '100vw';\n                iframe.style.height = '100vh';\n            }\n            console.log('Iframe success');\n            return true;\n        }\n        return false;\n    }\n\n    // 立即执行\n    adjustFullscreen();\n\n    // 定时检查,确保捕获动态加载的元素\n    const checkInterval = setInterval(() => {\n        if (adjustFullscreen()) {\n            clearInterval(checkInterval);\n        }\n    }, 500);\n\n    // 延长检查时间至 15 秒,以适配延迟加载的频道\n    setTimeout(() => {\n        clearInterval(checkInterval);\n    }, 15000);\n\n    // 额外的单次检查,增强兼容性\n    setTimeout(adjustFullscreen, 1000);\n    setTimeout(adjustFullscreen, 2000);\n})();", null);
        } else if (viewGroup instanceof android.webkit.WebView) {
            kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type android.webkit.WebView");
            ((android.webkit.WebView) viewGroup).evaluateJavascript("        (function() {\n    function adjustFullscreen() {\n        // 设置 body 样式,确保全屏覆盖\n        const body = document.body;\n        if (body) {\n            body.style.left = '0';\n            body.style.width = '100vw';\n            body.style.height = '100vh';\n            body.style.position = 'fixed';\n            body.style.overflow = 'hidden';\n        }\n\n        // 处理 video 元素\n        const video = document.querySelector('video');\n        if (video) {\n            video.style.position = 'fixed';\n            video.style.top = '0';\n            video.style.left = '0';\n            video.style.zIndex = '9999';\n            // 兼容低版本 Android\n            if (navigator.userAgent.includes('Android') && /Version\\/[4-8]\\./.test(navigator.userAgent)) {\n                video.style.width = '100%';\n                video.style.height = '100%';\n            } else {\n                video.style.objectFit = 'fill';\n                video.style.width = '100vw';\n                video.style.height = '100vh';\n            }\n            // 尝试自动播放\n            video.setAttribute('autoplay', 'true');\n            video.setAttribute('muted', 'true'); // 静音以绕过某些浏览器限制\n            try {\n                video.play();\n                console.log('Video play success');\n            } catch (e) {\n                console.log('Video play error: ' + e.message);\n            }\n            return true;\n        }\n\n        // 处理 iframe 元素\n        const iframe = document.querySelector('iframe');\n        if (iframe && iframe.src && !iframe.hidden) {\n            iframe.style.position = 'fixed';\n            iframe.style.top = '0';\n            iframe.style.left = '0';\n            iframe.style.zIndex = '9999';\n            // 兼容低版本 Android\n            if (navigator.userAgent.includes('Android') && /Version\\/[4-8]\\./.test(navigator.userAgent)) {\n                iframe.style.width = '100%';\n                iframe.style.height = '100%';\n            } else {\n                iframe.style.objectFit = 'fill';\n                iframe.style.width = '100vw';\n                iframe.style.height = '100vh';\n            }\n            console.log('Iframe success');\n            return true;\n        }\n        return false;\n    }\n\n    // 立即执行\n    adjustFullscreen();\n\n    // 定时检查,确保捕获动态加载的元素\n    const checkInterval = setInterval(() => {\n        if (adjustFullscreen()) {\n            clearInterval(checkInterval);\n        }\n    }, 500);\n\n    // 延长检查时间至 15 秒,以适配延迟加载的频道\n    setTimeout(() => {\n        clearInterval(checkInterval);\n    }, 15000);\n\n    // 额外的单次检查,增强兼容性\n    setTimeout(adjustFullscreen, 1000);\n    setTimeout(adjustFullscreen, 2000);\n})();", null);
        }
    }

    public static final Object h(w4 w4Var, Uri uri, boolean z2) {
        String path;
        String path2;
        TV m2;
        List<String> b2;
        String path3;
        String path4;
        TV m3;
        H0.a.INSTANCE.getClass();
        Map a2 = H0.a.a();
        I0.i iVar = w4Var.f1483b;
        List<String> list = (List) a2.get((iVar == null || (m3 = iVar.m()) == null) ? null : m3.g());
        if (list != null) {
            for (String str : list) {
                if (uri != null && (path4 = uri.getPath()) != null && e1.g.h0(path4, str, false)) {
                    uri.getPath();
                    ViewGroup viewGroup = w4Var.f1482a;
                    if (viewGroup instanceof WebView) {
                        return new WebResourceResponse(NanoHTTPD.MIME_PLAINTEXT, "utf-8", null);
                    }
                    if (viewGroup instanceof android.webkit.WebView) {
                        return new android.webkit.WebResourceResponse(NanoHTTPD.MIME_PLAINTEXT, "utf-8", null);
                    }
                    return null;
                }
            }
        }
        I0.i iVar2 = w4Var.f1483b;
        if (iVar2 != null && (m2 = iVar2.m()) != null && (b2 = m2.b()) != null) {
            for (String str2 : b2) {
                if (uri != null && (path3 = uri.getPath()) != null && e1.g.h0(path3, str2, false)) {
                    uri.getPath();
                    ViewGroup viewGroup2 = w4Var.f1482a;
                    if (viewGroup2 instanceof WebView) {
                        return new WebResourceResponse(NanoHTTPD.MIME_PLAINTEXT, "utf-8", null);
                    }
                    if (viewGroup2 instanceof android.webkit.WebView) {
                        return new android.webkit.WebResourceResponse(NanoHTTPD.MIME_PLAINTEXT, "utf-8", null);
                    }
                    return null;
                }
            }
        }
        if (uri != null && (path2 = uri.getPath()) != null && e1.o.Z(path2, ".css")) {
            ViewGroup viewGroup3 = w4Var.f1482a;
            if (viewGroup3 instanceof WebView) {
                return new WebResourceResponse("text/css", "utf-8", new ByteArrayInputStream(new byte[0]));
            }
            if (viewGroup3 instanceof android.webkit.WebView) {
                return new android.webkit.WebResourceResponse("text/css", "utf-8", new ByteArrayInputStream(new byte[0]));
            }
        } else if (!z2 && uri != null && (path = uri.getPath()) != null && (e1.o.Z(path, ".jpg") || e1.o.Z(path, ".jpeg") || e1.o.Z(path, ".png") || e1.o.Z(path, ".gif") || e1.o.Z(path, ".webp") || e1.o.Z(path, ".svg"))) {
            ViewGroup viewGroup4 = w4Var.f1482a;
            if (viewGroup4 instanceof WebView) {
                return new WebResourceResponse(MimeTypes.IMAGE_PNG, "utf-8", new ByteArrayInputStream(new byte[0]));
            }
            if (viewGroup4 instanceof android.webkit.WebView) {
                return new android.webkit.WebResourceResponse(MimeTypes.IMAGE_PNG, "utf-8", new ByteArrayInputStream(new byte[0]));
            }
        }
        return null;
    }

    public static final void l(w4 w4Var) {
        Context applicationContext = w4Var.requireActivity().getApplicationContext();
        kotlin.jvm.internal.j.c(applicationContext, "null cannot be cast to non-null type com.horsenma.yourtv.YourTVApplication");
        YourTVApplication yourTVApplication = (YourTVApplication) applicationContext;
        boolean h2 = N1.h();
        ViewGroup viewGroup = w4Var.f1482a;
        if (viewGroup != null) {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(h2 ? -1 : yourTVApplication.f3901i, h2 ? -1 : yourTVApplication.f3902j);
            layoutParams.gravity = 17;
            viewGroup.setLayoutParams(layoutParams);
        }
        ViewGroup viewGroup2 = w4Var.f1482a;
        if (viewGroup2 != null) {
            viewGroup2.requestLayout();
        }
        w4Var.k();
        ViewGroup viewGroup3 = w4Var.f1482a;
        if (viewGroup3 != null) {
            viewGroup3.getWidth();
        }
        ViewGroup viewGroup4 = w4Var.f1482a;
        if (viewGroup4 != null) {
            viewGroup4.getHeight();
        }
    }

    public final void i(ViewGroup viewGroup, YourTVApplication yourTVApplication) {
        if (viewGroup instanceof WebView) {
            WebView webView = (WebView) viewGroup;
            WebSettings settings = webView.getSettings();
            settings.setJavaScriptEnabled(true);
            settings.setDomStorageEnabled(true);
            settings.setDatabaseEnabled(true);
            settings.setJavaScriptCanOpenWindowsAutomatically(true);
            settings.setMediaPlaybackRequiresUserGesture(false);
            settings.setCacheMode(2);
            settings.setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0");
            viewGroup.setLayerType(2, null);
            webView.setFocusable(false);
            webView.setFocusableInTouchMode(false);
            webView.stopLoading();
            webView.clearCache(true);
            webView.clearHistory();
        } else if (viewGroup instanceof android.webkit.WebView) {
            android.webkit.WebView webView2 = (android.webkit.WebView) viewGroup;
            android.webkit.WebSettings settings2 = webView2.getSettings();
            settings2.setJavaScriptEnabled(true);
            settings2.setDomStorageEnabled(true);
            settings2.setDatabaseEnabled(true);
            settings2.setJavaScriptCanOpenWindowsAutomatically(true);
            settings2.setMediaPlaybackRequiresUserGesture(false);
            settings2.setMixedContentMode(0);
            settings2.setCacheMode(2);
            settings2.setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36");
            webView2.setLayerType(2, null);
            webView2.setClickable(false);
            webView2.setFocusable(false);
            webView2.setFocusableInTouchMode(false);
            webView2.stopLoading();
            webView2.clearCache(true);
            webView2.clearHistory();
        }
        boolean h2 = N1.h();
        ViewGroup viewGroup2 = this.f1482a;
        if (viewGroup2 != null) {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(h2 ? -1 : yourTVApplication.f3901i, h2 ? -1 : yourTVApplication.f3902j);
            layoutParams.gravity = 17;
            viewGroup2.setLayoutParams(layoutParams);
        }
        ViewGroup viewGroup3 = this.f1482a;
        if (viewGroup3 != null) {
            viewGroup3.requestLayout();
        }
    }

    public final void j() {
        ViewGroup viewGroup = this.f1482a;
        if (viewGroup instanceof WebView) {
            kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type com.tencent.smtt.sdk.WebView");
            ((WebView) viewGroup).evaluateJavascript("(function() {\n    // 断开所有MutationObserver\n    if (window.observers) {\n        window.observers.forEach(obs => obs.disconnect());\n        window.observers = [];\n    }\n    // 移除所有video/iframe\n    document.querySelectorAll('video, iframe').forEach(el => {\n        el.pause && el.pause();\n        el.src = '';\n        el.remove();\n    });\n    // 清空#showplayerbox\n    const box = document.querySelector('#showplayerbox');\n    if (box) {\n        while (box.firstChild) box.removeChild(box.firstChild);\n        if (box.shadowRoot) {\n            while (box.shadowRoot.firstChild) box.shadowRoot.removeChild(box.shadowRoot.firstChild);\n        }\n    }\n    // 重置旗标\n    window.sxrtvScriptExecuted = false;\n    console.log('Cleaned all players and observers');\n})();", null);
        } else if (viewGroup instanceof android.webkit.WebView) {
            kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type android.webkit.WebView");
            ((android.webkit.WebView) viewGroup).evaluateJavascript("(function() {\n    // 断开所有MutationObserver\n    if (window.observers) {\n        window.observers.forEach(obs => obs.disconnect());\n        window.observers = [];\n    }\n    // 移除所有video/iframe\n    document.querySelectorAll('video, iframe').forEach(el => {\n        el.pause && el.pause();\n        el.src = '';\n        el.remove();\n    });\n    // 清空#showplayerbox\n    const box = document.querySelector('#showplayerbox');\n    if (box) {\n        while (box.firstChild) box.removeChild(box.firstChild);\n        if (box.shadowRoot) {\n            while (box.shadowRoot.firstChild) box.shadowRoot.removeChild(box.shadowRoot.firstChild);\n        }\n    }\n    // 重置旗标\n    window.sxrtvScriptExecuted = false;\n    console.log('Cleaned all players and observers');\n})();", null);
        }
    }

    public final void k() {
        ViewGroup viewGroup = this.f1482a;
        if (viewGroup instanceof WebView) {
            kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type com.tencent.smtt.sdk.WebView");
            ((WebView) viewGroup).evaluateJavascript("(() => {\n    // 确保页面已加载\n    if (document.readyState !== 'complete' || !document.body) {\n        setTimeout(() => {\n            // 递归调用自身,直到页面加载完成\n            eval(arguments.callee.toString().replace('setTimeout', 'setTimeout(() => {'));\n        }, 500);\n        return;\n    }\n\n    // 移除所有可能干扰的样式\n    document.querySelectorAll('style[data-pip-scaling], div, section, article, main').forEach(el => {\n        if (el.tagName.toLowerCase() !== 'style') {\n            el.style.width = '100vw';\n            el.style.height = '100vh';\n            el.style.margin = '0';\n            el.style.padding = '0';\n            el.style.position = 'relative';\n            el.style.overflow = 'hidden';\n            el.style.transform = 'none';\n        } else {\n            el.remove();\n        }\n    });\n\n    const style = document.createElement('style');\n    style.type = 'text/css';\n    style.setAttribute('data-pip-scaling', 'true');\n    style.innerHTML = `\n        html, body {\n            margin: 0 !important;\n            padding: 0 !important;\n            width: 100vw !important;\n            height: 100vh !important;\n            overflow: hidden !important;\n            background-color: #000 !important;\n            position: absolute !important;\n            left: 0 !important;\n            top: 0 !important;\n            transform: none !important;\n        }\n        video, iframe, object, embed {\n            display: block !important;\n            position: fixed !important;\n            top: 0 !important;\n            left: 0 !important;\n            width: 100vw !important;\n            height: 100vh !important;\n            object-fit: fill !important;\n            background-color: transparent !important;\n            z-index: 9999 !important;\n            transform: none !important;\n        }\n    `;\n    document.head.appendChild(style);\n\n    const applyStyles = () => {\n        const video = document.querySelector('video');\n        if (video) {\n            video.style.width = '100vw';\n            video.style.height = '100vh';\n            video.style.objectFit = 'fill';\n            video.style.position = 'fixed';\n            video.style.top = '0';\n            video.style.left = '0';\n            video.style.zIndex = '9999';\n            video.style.transform = 'none';\n        }\n        const iframe = document.querySelector('iframe');\n        if (iframe) {\n            iframe.style.width = '100vw';\n            iframe.style.height = '100vh';\n            iframe.style.objectFit = 'fill';\n            iframe.style.position = 'fixed';\n            iframe.style.top = '0';\n            iframe.style.left = '0';\n            iframe.style.zIndex = '9999';\n            iframe.style.transform = 'none';\n        }\n        if (!video && !iframe) {\n            // 如果未找到 video 或 iframe,延迟重试\n            setTimeout(applyStyles, 500);\n        }\n    };\n    applyStyles();\n\n    // 强制触发重绘\n    document.body.style.display = 'none';\n    document.body.offsetHeight;\n    document.body.style.display = 'block';\n})();", null);
        } else if (viewGroup instanceof android.webkit.WebView) {
            kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type android.webkit.WebView");
            ((android.webkit.WebView) viewGroup).evaluateJavascript("(() => {\n    // 确保页面已加载\n    if (document.readyState !== 'complete' || !document.body) {\n        setTimeout(() => {\n            // 递归调用自身,直到页面加载完成\n            eval(arguments.callee.toString().replace('setTimeout', 'setTimeout(() => {'));\n        }, 500);\n        return;\n    }\n\n    // 移除所有可能干扰的样式\n    document.querySelectorAll('style[data-pip-scaling], div, section, article, main').forEach(el => {\n        if (el.tagName.toLowerCase() !== 'style') {\n            el.style.width = '100vw';\n            el.style.height = '100vh';\n            el.style.margin = '0';\n            el.style.padding = '0';\n            el.style.position = 'relative';\n            el.style.overflow = 'hidden';\n            el.style.transform = 'none';\n        } else {\n            el.remove();\n        }\n    });\n\n    const style = document.createElement('style');\n    style.type = 'text/css';\n    style.setAttribute('data-pip-scaling', 'true');\n    style.innerHTML = `\n        html, body {\n            margin: 0 !important;\n            padding: 0 !important;\n            width: 100vw !important;\n            height: 100vh !important;\n            overflow: hidden !important;\n            background-color: #000 !important;\n            position: absolute !important;\n            left: 0 !important;\n            top: 0 !important;\n            transform: none !important;\n        }\n        video, iframe, object, embed {\n            display: block !important;\n            position: fixed !important;\n            top: 0 !important;\n            left: 0 !important;\n            width: 100vw !important;\n            height: 100vh !important;\n            object-fit: fill !important;\n            background-color: transparent !important;\n            z-index: 9999 !important;\n            transform: none !important;\n        }\n    `;\n    document.head.appendChild(style);\n\n    const applyStyles = () => {\n        const video = document.querySelector('video');\n        if (video) {\n            video.style.width = '100vw';\n            video.style.height = '100vh';\n            video.style.objectFit = 'fill';\n            video.style.position = 'fixed';\n            video.style.top = '0';\n            video.style.left = '0';\n            video.style.zIndex = '9999';\n            video.style.transform = 'none';\n        }\n        const iframe = document.querySelector('iframe');\n        if (iframe) {\n            iframe.style.width = '100vw';\n            iframe.style.height = '100vh';\n            iframe.style.objectFit = 'fill';\n            iframe.style.position = 'fixed';\n            iframe.style.top = '0';\n            iframe.style.left = '0';\n            iframe.style.zIndex = '9999';\n            iframe.style.transform = 'none';\n        }\n        if (!video && !iframe) {\n            // 如果未找到 video 或 iframe,延迟重试\n            setTimeout(applyStyles, 500);\n        }\n    };\n    applyStyles();\n\n    // 强制触发重绘\n    document.body.style.display = 'none';\n    document.body.offsetHeight;\n    document.body.style.display = 'block';\n})();", null);
        }
    }

    public final void m(String str) {
        this.f1487f = 0;
        this.f1488g = false;
        this.f1490i = str;
        if (this.f1482a == null) {
            return;
        }
        j();
        ViewGroup viewGroup = this.f1482a;
        if (viewGroup instanceof WebView) {
            kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type com.tencent.smtt.sdk.WebView");
            WebView webView = (WebView) viewGroup;
            webView.stopLoading();
            webView.clearCache(true);
            webView.clearHistory();
            new Handler(Looper.getMainLooper()).postDelayed(new l4(webView, str, 0), 300L);
        } else if (viewGroup instanceof android.webkit.WebView) {
            kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type android.webkit.WebView");
            android.webkit.WebView webView2 = (android.webkit.WebView) viewGroup;
            webView2.stopLoading();
            webView2.clearCache(true);
            webView2.clearHistory();
            new Handler(Looper.getMainLooper()).postDelayed(new m4(webView2, str, 0), 300L);
        }
        ViewGroup viewGroup2 = this.f1482a;
        if (viewGroup2 != null) {
            viewGroup2.setVisibility(0);
        }
    }

    public final void n() {
        if (this.f1488g) {
            this.f1488g = false;
            ViewGroup viewGroup = this.f1482a;
            if (viewGroup instanceof WebView) {
                kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type com.tencent.smtt.sdk.WebView");
                ((WebView) viewGroup).stopLoading();
            } else if (viewGroup instanceof android.webkit.WebView) {
                kotlin.jvm.internal.j.c(viewGroup, "null cannot be cast to non-null type android.webkit.WebView");
                ((android.webkit.WebView) viewGroup).stopLoading();
            }
        }
    }

    @Override
    public final void onActivityCreated(Bundle bundle) {
        androidx.fragment.app.M activity = getActivity();
        kotlin.jvm.internal.j.c(activity, "null cannot be cast to non-null type com.horsenma.yourtv.MainActivity");
        super.onActivityCreated(bundle);
    }

    @Override
    public final View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
        android.webkit.WebView webView;
        kotlin.jvm.internal.j.e(inflater, "inflater");
        FrameLayout frameLayout = new FrameLayout(requireContext());
        frameLayout.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        frameLayout.setBackgroundColor(requireContext().getColor(R.color.black));
        l(this);
        YourTVApplication yourTVApplication = YourTVApplication.f3892p;
        android.support.v4.media.session.b.E().f3905n = new C0116p0(this, 1);
        AppCompatImageView appCompatImageView = new AppCompatImageView(requireContext(), null);
        appCompatImageView.setId(View.generateViewId());
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        layoutParams.gravity = 8388629;
        layoutParams.rightMargin = 8;
        appCompatImageView.setLayoutParams(layoutParams);
        appCompatImageView.setImageResource(2131230937);
        appCompatImageView.setVisibility(8);
        this.f1485d = appCompatImageView;
        ProgressBar progressBar = new ProgressBar(requireContext(), null, R.attr.progressBarStyleHorizontal);
        progressBar.setId(View.generateViewId());
        float f2 = 5;
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams((int) (200 * Resources.getSystem().getDisplayMetrics().density), (int) (Resources.getSystem().getDisplayMetrics().density * f2));
        layoutParams2.gravity = 17;
        progressBar.setPadding((int) (f2 * Resources.getSystem().getDisplayMetrics().density), 0, 0, 0);
        progressBar.setLayoutParams(layoutParams2);
        progressBar.setMax(100);
        progressBar.setProgress(50);
        progressBar.setProgressDrawable(requireContext().getDrawable(2131230816));
        progressBar.setVisibility(8);
        this.f1486e = progressBar;
        AppCompatImageView appCompatImageView2 = this.f1485d;
        if (appCompatImageView2 == null) {
            kotlin.jvm.internal.j.i("icon");
            throw null;
        }
        frameLayout.addView(appCompatImageView2);
        ProgressBar progressBar2 = this.f1486e;
        if (progressBar2 == null) {
            kotlin.jvm.internal.j.i("volume");
            throw null;
        }
        frameLayout.addView(progressBar2);
        Context applicationContext = requireActivity().getApplicationContext();
        kotlin.jvm.internal.j.c(applicationContext, "null cannot be cast to non-null type com.horsenma.yourtv.YourTVApplication");
        YourTVApplication yourTVApplication2 = (YourTVApplication) applicationContext;
        try {
            if (N1.q() && android.support.v4.media.session.b.E().f3893a) {
                WebView webView2 = new WebView(requireContext());
                i(webView2, yourTVApplication2);
                webView2.setWebChromeClient(new t4(this));
                webView2.setWebViewClient(new v4(this));
                webView = webView2;
            } else {
                android.webkit.WebView webView3 = new android.webkit.WebView(requireContext());
                i(webView3, yourTVApplication2);
                webView3.setWebChromeClient(new o4(this));
                webView3.setWebViewClient(new r4(this));
                webView = webView3;
            }
            this.f1482a = webView;
            ViewParent parent = webView.getParent();
            ViewGroup viewGroup2 = parent instanceof ViewGroup ? (ViewGroup) parent : null;
            if (viewGroup2 != null) {
                viewGroup2.removeView(webView);
            }
            frameLayout.addView(webView);
        } catch (Exception e2) {
            e2.getMessage();
            I0.i iVar = this.f1483b;
            if (iVar != null) {
                iVar.f1586j.h("WebView creation failed");
            }
        }
        ViewGroup viewGroup3 = this.f1482a;
        if (viewGroup3 != null) {
            viewGroup3.setOnTouchListener(new ViewOnTouchListenerC0102m1(this, 3));
        }
        androidx.fragment.app.M activity = getActivity();
        kotlin.jvm.internal.j.c(activity, "null cannot be cast to non-null type com.horsenma.yourtv.MainActivity");
        ((MainActivity) activity).B("WebFragment");
        return frameLayout;
    }

    @Override
    public final void onDestroyView() {
        super.onDestroyView();
        this.f1484c.removeCallbacksAndMessages(null);
        ViewGroup viewGroup = this.f1482a;
        if (viewGroup != null) {
            ViewParent parent = viewGroup.getParent();
            ViewGroup viewGroup2 = parent instanceof ViewGroup ? (ViewGroup) parent : null;
            if (viewGroup2 != null) {
                viewGroup2.removeView(viewGroup);
            }
            if (viewGroup instanceof WebView) {
                ((WebView) viewGroup).destroy();
            } else if (viewGroup instanceof android.webkit.WebView) {
                ((android.webkit.WebView) viewGroup).destroy();
            }
        }
        this.f1482a = null;
    }
}