导航菜单

页面标题

页面副标题

MedEd v5.3.6 - AIGuruPlayerActivity.java 源代码

正在查看: MedEd v5.3.6 应用的 AIGuruPlayerActivity.java JAVA 源代码文件

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


package com.gyanguru.ui.video;

import android.content.res.Resources;
import android.os.Build;
import android.os.Handler;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.ViewGroup;
import android.webkit.WebView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.d;
import com.gyanguru.domain.model.AIGuruVideoData;
import com.penpencil.core.data.dto.VideoCookieData;
import com.penpencil.k8_timeless.ui.landingcomponents.result.kIQN.hcnACoYyf;
import com.penpencil.player.composePlayer.PWCPlayerBuilder;
import com.penpencil.player.webYoutube.VideoEnabledWebView;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;

@Metadata
public final class AIGuruPlayerActivity extends oP0<s5, wN0> implements RI1, d {
    public static final int N0 = 0;
    public String H0;
    public String I0;
    public boolean J0;
    public nq3 K0;
    public final TB3 L0;
    public final Xc1 M0;

    public AIGuruPlayerActivity() {
        super(new uj(1));
        a aVar = a.i;
        this.L0 = new TB3();
        this.M0 = le1.b(new vj(this, 3));
    }

    public final void C0(long j) {
        X0().f.setImageResource(wp2.ic_play_new);
    }

    public final void H0(long j) {
    }

    public final void J0(long j) {
    }

    public final void S0(Ur3 ur3) {
        s5 s5Var = (s5) ur3;
        Intrinsics.checkNotNullParameter(s5Var, "<this>");
        vz3 i = us3.i(getWindow().getDecorView());
        if (i != null) {
            e eVar = i.a;
            eVar.e();
            eVar.a(7);
        }
        Y0();
        Lx.q(HA3.k(this), (CoroutineContext) null, (mV) null, new i1(this, s5Var, (iT) null), 3);
        getOnBackPressedDispatcher().a(this, new j1(this));
    }

    public final void V0(Ur3 ur3, Et3 et3) {
        Intrinsics.checkNotNullParameter((s5) ur3, "<this>");
        Intrinsics.checkNotNullParameter((wN0) et3, "vm");
        AIGuruVideoData aIGuruVideoData = Build.VERSION.SDK_INT <= 33 ? (AIGuruVideoData) getIntent().getParcelableExtra("EXTRA_METADATA") : (AIGuruVideoData) Z0.a(getIntent());
        if (aIGuruVideoData == null) {
            l.o(this, Sq2.something_went_wrong);
            finish();
            return;
        }
        int i = b.a[aIGuruVideoData.getType().ordinal()];
        if (i == -1) {
            l.o(this, Sq2.something_went_wrong);
            finish();
            return;
        }
        if (i == 1) {
            this.H0 = getString(Sq2.label_video);
            this.I0 = aIGuruVideoData.getYtUrl();
            Number startTime = aIGuruVideoData.getStartTime();
            Lx.q(HA3.k(this), (CoroutineContext) null, (mV) null, new c1(this, startTime != null ? startTime.longValue() : 0L, (iT) null), 3);
            R0().i.setVisibility(0);
            X0().a.setVisibility(0);
            R0().b.setVisibility(8);
            return;
        }
        if (i != 2) {
            l.o(this, Sq2.something_went_wrong);
            finish();
            return;
        }
        this.H0 = aIGuruVideoData.getTitle();
        String l = Af.l(UW2.f(aIGuruVideoData.getSecureVideoUrl()), (VideoCookieData) null);
        this.I0 = l;
        String f = UW2.f(l);
        String str = this.H0;
        String thumbnail = aIGuruVideoData.getThumbnail();
        Number startTime2 = aIGuruVideoData.getStartTime();
        long longValue = startTime2 != null ? startTime2.longValue() : 0L;
        Number endTime = aIGuruVideoData.getEndTime();
        R0().b.setContent(new pM(1079177394, new b1(new PWCPlayerBuilder(f, str, longValue, false, true, false, true, false, thumbnail, "penpencilvdo", true, false, true, false, Long.valueOf(endTime != null ? endTime.longValue() : 0L), (String) null, 43176, (DefaultConstructorMarker) null)), true));
        R0().b.setVisibility(0);
        R0().i.setVisibility(8);
        X0().a.setVisibility(8);
    }

    public final hc1 X0() {
        Object value = this.M0.getValue();
        Intrinsics.checkNotNullExpressionValue(value, "getValue(...)");
        return (hc1) value;
    }

    public final void Y0() {
        ViewGroup.LayoutParams layoutParams = R0().e.getLayoutParams();
        Intrinsics.checkNotNullExpressionValue(layoutParams, "getLayoutParams(...)");
        layoutParams.width = -1;
        layoutParams.height = getResources().getDimensionPixelSize(fp2.dp_0);
        R0().e.setLayoutParams(layoutParams);
        ViewGroup.LayoutParams layoutParams2 = R0().e.getLayoutParams();
        Intrinsics.e(layoutParams2, "null cannot be cast to non-null type android.view.ViewGroup.MarginLayoutParams");
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams2;
        Resources resources = getResources();
        int i = fp2.dp_16;
        marginLayoutParams.setMarginStart(resources.getDimensionPixelSize(i));
        marginLayoutParams.setMarginEnd(getResources().getDimensionPixelSize(i));
        marginLayoutParams.topMargin = 0;
        marginLayoutParams.bottomMargin = 0;
        R0().e.setLayoutParams(marginLayoutParams);
        R0().e.setRadius(getResources().getDimension(fp2.dp_12));
        d dVar = new d();
        dVar.b(R0().g);
        dVar.c(R0().e.getId(), 3, 3);
        dVar.c(R0().e.getId(), 4, 4);
        dVar.c(R0().e.getId(), 2, 2);
        dVar.c(R0().e.getId(), 1, 1);
        ConstraintLayout constraintLayout = R0().g;
        dVar.a(constraintLayout);
        constraintLayout.setConstraintSet((d) null);
        constraintLayout.requestLayout();
    }

    public final void b(long j, long j2) {
    }

    public final void d(WebView webView, String str) {
        Intrinsics.checkNotNullParameter(webView, "webView");
        Intrinsics.checkNotNullParameter(str, "str");
        this.L0.getClass();
        Intrinsics.checkNotNullParameter(webView, "webView");
        if (webView != null) {
            try {
                Iterator it = TB3.a().iterator();
                Intrinsics.checkNotNullExpressionValue(it, "iterator(...)");
                while (it.hasNext()) {
                    String str2 = (String) it.next();
                    webView.loadUrl("javascript:(function() { var elements = document.getElementsByClassName('" + str2 + "')[0].style.display='none'; })()");
                    webView.loadUrl("javascript:(function() {  var elements = document.getElementsByClassName('" + str2 + "'); while(elements.length > 0)elements[0].parentNode.removeChild(elements[0]);  })()");
                }
                new Handler().postDelayed(new b(webView), 2000L);
            } catch (Exception unused) {
            }
        }
        long uptimeMillis = SystemClock.uptimeMillis();
        float width = (webView.getWidth() / 2) + webView.getLeft();
        float height = (webView.getHeight() / 2) + webView.getTop();
        long j = uptimeMillis + 100;
        MotionEvent obtain = MotionEvent.obtain(uptimeMillis, j, 0, width, height, 0);
        obtain.setSource(2);
        MotionEvent obtain2 = MotionEvent.obtain(uptimeMillis, j + 2, 1, width, height, 0);
        obtain2.setSource(2);
        webView.dispatchTouchEvent(obtain);
        webView.dispatchTouchEvent(obtain2);
        webView.setVisibility(0);
        webView.loadUrl("javascript:window.INTERFACE.processContent(document.getElementsByTagName('body')[0].innerText);");
        if (webView.getSettings().getJavaScriptEnabled()) {
            webView.evaluateJavascript("javascript:\n        \n        var mControlsVisibilityTimer;\n        \n        var player = document.getElementsByTagName('video')[0];\n        player.BP = 0;\n        player.addEventListener('timeupdate', function(e){\n        var that = this;\n        (function(){\n            setTimeout(function(){\n              that.BP = that.currentTime;\n            }, 500);\n          }).call(that);}\n          );\n        function play(event) {\n            _WebYtPlayer.onPlayEvent(Math.floor(player.currentTime));\n            onControlsVisibility(event)\n        }\n        function pause(event) {    \n            _WebYtPlayer.onPauseEvent(Math.floor(player.currentTime));\n            if (mControlsVisibilityTimer!=null) clearTimeout(mControlsVisibilityTimer);\n        }\n        function seeking(event) {\n            _WebYtPlayer.onSeekEvent(Math.floor(this.BP), Math.floor(player.currentTime));\n            onControlsVisibility(event)\n        }\n        function ended(event) {\n            _WebYtPlayer.onCloseVideoPlayer();\n            _WebYtPlayer.notifyVideoEnd();\n        }\n        function getVideoLength() {\n            _WebYtPlayer.onVideoLength(Math.floor(player.duration));\n        }\n        function pauseVideo() {\n            player.pause();\n        }\n        function playVideo() {\n            player.play();\n        }\n        function getCurrentPos() {\n             _WebYtPlayer.onVideoCurrentTime(Math.floor(player.currentTime));\n        }\n        \n        function toggleFullScreenWithPosition() {\n             _WebYtPlayer.toggleFullScreen(Math.floor(player.currentTime));\n        }\n        \n        function backPress() {\n            _WebYtPlayer.playerBackPress(Math.floor(player.currentTime));\n        }\n        \n        function forward10s() {\n            player.currentTime += 10;\n        }\n        \n        function rewind10s() {\n            player.currentTime -=10;\n        }\n        \n        function onControlsVisibility(event) {\n            _WebYtPlayer.onShowControls();\n            \n            if (mControlsVisibilityTimer == null) mControlsVisibilityTimer = setTimeout(function() {onControlsVisibilityLost(event)}, 4300);\n            else {\n                clearTimeout(mControlsVisibilityTimer)\n                mControlsVisibilityTimer = setTimeout(function() {onControlsVisibilityLost(event)}, 4100);\n            }\n        }\n        \n        function onControlsVisibilityLost(event) {\n            _WebYtPlayer.onHideControls();\n        }\n        \n        function onSettingClick() {\n            var element = document.getElementsByClassName('ytp-button ytp-settings-button')[0];\n            element.onclick = function(event) { \n                setTimeout( \n                    function(){ \n                       disableMenuOptionsInSettings()\n                       \n                       var ariaExpanded = element.attributes['aria-expanded'].value;\n                       if (ariaExpanded == 'true') onControlsVisibilityLost(event)\n                       else onControlsVisibility(event)\n                       \n                       _WebYtPlayer.onSettingClick(ariaExpanded);\n                    } \n                , 250);\n            }\n        }\n        \n        \n        function showCurrentTimeView() {\n            \n            var elementTime = document.getElementsByClassName('ytp-time-display')[0];\n            \n            if (elementTime.style.display == 'inline') return;\n            \n            \n            // setCurrent time in timeTv\n            var currentTimeElement = document.getElementsByClassName('ytp-time-current')[0];\n            setInterval( function(){\n               \n                elementTime.style.display='inline';\n                \n                if (document.fullscreenElement) return;\n                \n                currentTimeElement.textContent = toHHMMSS(player.currentTime);\n                \n                // setTotal duration.\n                if ( player.duration !=null && !isNaN(player.duration) )\n                document.getElementsByClassName('ytp-time-duration')[0].textContent = toHHMMSS(player.duration);\n            }, 1000);\n\n        }\n        \n        /** \n        *This method disables if there is any menu-item label as 'More options' in settings. \n        *More options consist inner menu-options like copy-url, account links which will also be disabled.\n        */\n        \n        function disableMenuOptionsInSettings() {\n            var elements = document.getElementsByClassName('ytp-panel-menu')[0]?.children;\n            var elementArray = Array.from(elements);\n            elementArray.forEach ((element) => {\n                    var labelElement = element.getElementsByClassName('ytp-menuitem-label')[0];\n                    if (labelElement !=null && labelElement.innerHTML.includes('More options')) {\n                        hideUI(element);\n                        return;\n                    }   \n                }\n            )\n        }\n\n        function exitFullScreen() {\n            if (document.fullscreenElement) document.exitFullscreen();\n        }\n        \n        function hideUI(element) {\n            element.style.display = 'none';\n        }\n        \n        function showUI(element){\n            element.style.display = 'inline';\n        }\n\n        var toHHMMSS = (secs) => {\n            \n            var sec_num = parseInt(secs, 10)\n            var hours   = Math.floor(sec_num / 3600)\n            var minutes = Math.floor(sec_num / 60) % 60\n            var seconds = sec_num % 60\n\n            return [hours,minutes,seconds]\n                .map(v => v < 10 ? \"0\" + v : v)\n                .filter((v,i) => v !== \"00\" || i > 0)\n                .join(\":\")\n        }\n       \n       player.addEventListener('play', play);\n       player.addEventListener('pause', pause);\n       player.addEventListener('seeking', seeking);\n       player.addEventListener('ended', ended);\n       \n       function setClickListenerOnPlayer() {\n           player.addEventListener('click', onControlsVisibility);\n       }\n       \n    ", new Sx3());
            Ux3.a(webView, "onSettingClick", new Object[0]);
            Ux3.a(webView, "showCurrentTimeView", new Object[0]);
            Ux3.a(webView, "setClickListenerOnPlayer", new Object[0]);
        }
        WebView.setWebContentsDebuggingEnabled(false);
    }

    public final void g(boolean z) {
        Lx.q(HA3.k(this), (CoroutineContext) null, (mV) null, new c(this, z, (iT) null), 3);
    }

    public final void h0() {
        l.p(this, getString(Sq2.msg_video_ended));
        finish();
    }

    public final void o0(long j) {
        X0().f.setImageResource(wp2.ic_pause_new);
    }

    public final void onBackPressed() {
        if (!this.J0) {
            R0().i.onPause();
            R0().i.destroy();
            finish();
        } else {
            VideoEnabledWebView videoEnabledWebView = R0().i;
            Intrinsics.checkNotNullExpressionValue(videoEnabledWebView, "webView");
            this.L0.getClass();
            Intrinsics.checkNotNullParameter(videoEnabledWebView, "webView");
            Ux3.a(videoEnabledWebView, "exitFullScreen", new Object[0]);
        }
    }

    public final void onDestroy() {
        R0().i.onPause();
        R0().i.destroy();
        super.onDestroy();
    }

    public final void onResume() {
        R0().i.onResume();
        if (this.J0) {
            getWindow().getDecorView().setSystemUiVisibility(5382);
        }
        super/*androidx.fragment.app.e*/.onResume();
    }

    public final void q0(long j) {
    }

    public final void w0(long j) {
    }

    public final void onPause() {
        s5 R0 = R0();
        VideoEnabledWebView videoEnabledWebView = R0().i;
        Intrinsics.checkNotNullExpressionValue(videoEnabledWebView, "webView");
        this.L0.getClass();
        Intrinsics.checkNotNullParameter(videoEnabledWebView, "webView");
        videoEnabledWebView.loadUrl(hcnACoYyf.WUGKOY);
        X0().f.setImageResource(wp2.ic_play_new);
        R0.i.onPause();
        super/*androidx.fragment.app.e*/.onPause();
    }
}