QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 AudioFMRNNativePage.java 源代码,内容仅作参考


package com.tencent.mtt.external.audiofm.rn;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import com.dike.lib.apkmarker.Apk;
import com.tencent.common.utils.UrlUtils;
import com.tencent.ilive.opensdk.pe.core.MediaBuffer;
import com.tencent.mtt.QbActivityBase;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.webview.QBWebView;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.window.IPage;
import com.tencent.mtt.browser.window.data.PageInfo;
import com.tencent.mtt.browser.window.templayer.BaseNativeGroup;
import com.tencent.mtt.external.audiofm.utils.AudioFMUrlUtils;
import com.tencent.mtt.hippy.common.HippyMap;
import com.tencent.mtt.hippy.qb.portal.HippyNativePage;
import com.tencent.mtt.hippy.qb.portal.HippyPageEventHub;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebView;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebViewController;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebViewInternal;
import com.tencent.mtt.hippy.uimanager.HippyCustomViewCreator;
import com.tencent.mtt.history.base.IHistory;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.setting.BaseSettings;
import java.util.HashMap;

public class AudioFMRNNativePage extends HippyNativePage implements ActivityHandler.ActivityStateListener, HippyQBWebViewInternal.OnWebChromeClientCallback {

    AudioHippyPageEventHub f50953a;

    private HippyQBWebView f50954b;

    private AudioFMRNPageManager f50955c;

    private Context f50956d;
    private HashMap<String, String> e;

    public AudioFMRNNativePage(Context context, BaseNativeGroup baseNativeGroup, HippyNativePage.IRNPageUrlListener iRNPageUrlListener, String str) {
        super(context, new FrameLayout.LayoutParams(-1, -1, 17), baseNativeGroup, 0, false, iRNPageUrlListener, a(str));
        this.e = new HashMap<>();
        this.f50955c = AudioFMRNPageManager.a();
        this.f50955c.b();
        this.f50956d = context;
        this.f50953a = new AudioHippyPageEventHub(context);
        ActivityHandler.b().a(this);
        this.e.put(Apk.IEditor.KEY_CHANNEL, AudioFMUrlUtils.c());
    }

    private static String a(String str) {
        HashMap<String, String> urlParam = UrlUtils.getUrlParam(str);
        return (urlParam != null && urlParam.containsKey("module") && urlParam.containsKey("component")) ? str : UrlUtils.addParamsToUrl(UrlUtils.addParamsToUrl(str, "module=AudioApp"), "component=AudioApp");
    }

    private void a() {
        InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService("input_method");
        View findFocus = findFocus();
        if (inputMethodManager == null || findFocus == null) {
            return;
        }
        inputMethodManager.hideSoftInputFromWindow(findFocus.getWindowToken(), 0);
    }

    public synchronized void a(HippyQBWebView hippyQBWebView) {
        this.f50954b = hippyQBWebView;
        hippyQBWebView.setWebChromeClientCallback(this);
        this.f50953a.setHippyQBWebView(this.f50954b);
    }

    private void b() {
        onStart();
    }

    private synchronized HippyQBWebViewInternal getRealQBWebview() {
        if (this.f50954b == null) {
            return null;
        }
        return this.f50954b.getRealWebView();
    }

    @Override
    public void active() {
        super.active();
        interceptUnitTime(this.e);
    }

    @Override
    public void back(boolean z) {
        HippyQBWebViewInternal realQBWebview = getRealQBWebview();
        if (realQBWebview != null) {
            if (realQBWebview.isSelectMode()) {
                if (realQBWebview.getSelection() != null) {
                    realQBWebview.getSelection().e();
                }
            } else if (realQBWebview.canGoBack()) {
                realQBWebview.goBack();
            }
        }
    }

    @Override
    public boolean can(int i) {
        switch (i) {
            case 1:
                return true;
            case 2:
            case 3:
            case 4:
                return false;
            case 5:
                return true;
            case 6:
                return false;
            case 7:
            case 8:
            case 9:
                return true;
            case 10:
            case 12:
            case 13:
            default:
                return false;
            case 11:
                if (BaseSettings.a().getInt(MediaBuffer.AVMediaSetting.VIDEO_ROTATE, 1) == 3) {
                    return false;
                }
                break;
        }
    }

    @Override
    public boolean canGoBack() {
        HippyQBWebViewInternal realQBWebview = getRealQBWebview();
        return realQBWebview != null && (realQBWebview.canGoBack() || realQBWebview.isSelectMode());
    }

    @Override
    public boolean canGoForward() {
        return false;
    }

    @Override
    public boolean coverToolbar() {
        return true;
    }

    @Override
    public void deactive() {
        super.deactive();
    }

    @Override
    public void destroy() {
        super.destroy();
        ActivityHandler.b().b(this);
        HippyQBWebView hippyQBWebView = this.f50954b;
        if (hippyQBWebView != null) {
            hippyQBWebView.setWebChromeClientCallback(null);
            this.f50954b = null;
        }
        this.f50955c.c();
    }

    @Override
    public boolean edgeBackforward() {
        return this.f50953a.isToolbarVisi();
    }

    @Override
    public void forward() {
        super.forward();
    }

    @Override
    public HippyCustomViewCreator getCustomViewCreater() {
        return new HippyCustomViewCreator() {
            @Override
            public View createCustomView(String str, Context context, HippyMap hippyMap) {
                if (!TextUtils.equals(str, HippyQBWebViewController.CLASS_NAME) && !TextUtils.equals(str, HippyQBWebViewController.CLASS_NAME_TKD)) {
                    return null;
                }
                AudioFMReactWebview audioFMReactWebview = new AudioFMReactWebview(context);
                AudioFMRNNativePage.this.a(audioFMReactWebview);
                return audioFMReactWebview;
            }
        };
    }

    @Override
    public String getDemotionUrl() {
        return "https://audio.html5.qq.com/hot?autoQbDirect=0";
    }

    @Override
    protected HippyPageEventHub getEventHub() {
        return this.f50953a;
    }

    @Override
    public String getPageTitle() {
        return MttResources.l(R.string.a89);
    }

    @Override
    public IPage.POP_TYPE getPopType() {
        return IPage.POP_TYPE.ONLY_SELF;
    }

    @Override
    public String getRestoreUrl() {
        return null;
    }

    @Override
    public PageInfo getShareBundle() {
        return new PageInfo(0);
    }

    @Override
    public int getStatusBarBgColor() {
        return SkinManager.s().l() ? -14473171 : -1;
    }

    @Override
    public void interceptUnitTime(HashMap<String, String> hashMap) {
        super.interceptUnitTime(hashMap);
    }

    @Override
    public boolean isForcePortalScreen() {
        return true;
    }

    @Override
    public void loadUrl(String str) {
        super.loadUrl(a(str));
    }

    @Override
    protected boolean needAddToHistory() {
        return getRealQBWebview() != null;
    }

    @Override
    public void onActivityState(QbActivityBase qbActivityBase, ActivityHandler.LifeCycle lifeCycle) {
        if (ActivityHandler.a((Context) qbActivityBase) && lifeCycle == ActivityHandler.LifeCycle.onResume) {
            b();
        }
    }

    @Override
    public boolean onBackPressed() {
        a();
        return super.onBackPressed();
    }

    public void onReceivedTitle(QBWebView qBWebView, String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        ((IHistory) SDKContext.getInstance().getService(IHistory.class)).addHistory(MttResources.l(R.string.a89) + " " + str, this.mUrl);
    }

    @Override
    public void onStart() {
        super.onStart();
        this.f50953a.a(this.mHippyRootView);
        interceptUnitTime(this.e);
    }
}