TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

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


package com.tencent.mobileqq.vaswebviewplugin;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.theme.ThemeUtil;
import com.tencent.mobileqq.webview.swift.WebViewPlugin;
import com.tencent.qphone.base.util.BaseApplication;
import com.tencent.qphone.base.util.QLog;
import com.tencent.theme.SkinEngine;
import java.io.File;
import org.json.JSONObject;
public class ThemeUiPlugin extends VasWebviewUiPlugin {
    public static final String EXTRA_THEME_ID = "extra_theme_id";
    public static final String REPORT_COPYCAT_THEME_DOWNLOAD_TAG = "report_copycat_theme_file_download";
    public static final int REPORT_THEME_DOWNLOAD_CONTENT_RANGE_IILEGAL = 89065;
    public static final int REPORT_THEME_DOWNLOAD_DATA_WRONG = 89068;
    public static final int REPORT_THEME_DOWNLOAD_MKDIR_FAILED = 89069;
    public static final int REPORT_THEME_DOWNLOAD_NOT_EQUAL = 89066;
    public static final int REPORT_THEME_DOWNLOAD_RENAME_FAILED = 89067;
    public static final String REPORT_THEME_DOWNLOAD_TAG = "report_theme_file_download";
    static final int REPORT_THEME_INFO = 1;
    private static final String TAG = "ThemeUiPlugin";
    public static String initCurrThemeNameForReport;
    public static int initDownloadedThemeNumForReport;
    public static Handler reportHandler;
    public static int reportTimes;

    @Override
    public void OnActivityResume() {
        this.activity.setTitle("主题");
    }

    public static String getReportCurrThemeName() {
        String skinRootPath = SkinEngine.getInstances().getSkinRootPath();
        if (skinRootPath == null || skinRootPath.trim().length() == 0) {
            return "default_theme";
        }
        if (skinRootPath.charAt(skinRootPath.length() - 1) == File.separatorChar) {
            skinRootPath = skinRootPath.substring(0, skinRootPath.length() - 1);
        }
        return skinRootPath.substring(skinRootPath.lastIndexOf(File.separatorChar), skinRootPath.length());
    }

    public static void destroy(QQAppInterface qQAppInterface) {
        initDownloadedThemeNumForReport = 0;
        initCurrThemeNameForReport = null;
        reportTimes = 0;
        if (reportHandler != null) {
            reportHandler.removeMessages(1);
        }
    }

    public static void reportThemeNumAndCurrThemeName(final QQAppInterface qQAppInterface, final String str) {
        reportTimes = 0;
        if (reportHandler == null) {
            reportHandler = new vsh(BaseApplication.getContext().getMainLooper());
        }
        reportHandler.removeMessages(1);
        initDownloadedThemeNumForReport = 0;
        initCurrThemeNameForReport = null;
        qQAppInterface.a(new Runnable() {
            @Override
            public void run() {
                ThemeUiPlugin.initDownloadedThemeNumForReport = ThemeUtil.getThemeDownloadNum(QQAppInterface.this.getApp());
                ThemeUiPlugin.initCurrThemeNameForReport = ThemeUtil.getUserCurrentThemeId(QQAppInterface.this);
                Message obtainMessage = ThemeUiPlugin.reportHandler.obtainMessage();
                obtainMessage.what = 1;
                obtainMessage.obj = new Object[]{str, QQAppInterface.this};
                if (QLog.isColorLevel()) {
                    QLog.d(ThemeUiPlugin.TAG, 2, "begin to report theme info");
                }
                if (QLog.isColorLevel()) {
                    QLog.d(ThemeUiPlugin.TAG, 2, "initDownloadedThemeNumForReport is:" + ThemeUiPlugin.initDownloadedThemeNumForReport + ",initCurrThemeNameForReport is:" + ThemeUiPlugin.initCurrThemeNameForReport);
                }
                ThemeUiPlugin.reportHandler.sendMessage(obtainMessage);
            }
        });
    }

    @Override
    public boolean onActivityResult(int i, int i2, Intent intent) {
        if (QLog.isColorLevel()) {
            QLog.i(TAG, 2, "BaseWebActivity onActivityResult requestCode=" + i + ",resultCode=" + i2);
        }
        if (i2 == -1) {
            switch (i) {
                case 4:
                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                    try {
                        String stringExtra = intent.getStringExtra("callbackSn");
                        String stringExtra2 = intent.getStringExtra("result");
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("responseId", stringExtra);
                        jSONObject.put(WebViewPlugin.KEY_RESPONSE, new JSONObject(stringExtra2));
                        if (QLog.isColorLevel()) {
                            QLog.i(TAG, 2, "BaseWebActivity loadUrl setMessage =" + jSONObject.toString());
                        }
                        this.mRuntime.m9631a().loadUrl("javascript:window.qqJSBridge&&qqJSBridge.setMessage('" + jSONObject.toString() + "');");
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    return true;
            }
        }
        return false;
    }

    @Override
    public long getPluginBusiness() {
        return 32L;
    }
}