导航菜单

页面标题

页面副标题

小柿子 v1.3.8 - SjmGameActivity.java 源代码

正在查看: 小柿子 v1.3.8 应用的 SjmGameActivity.java JAVA 源代码文件

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


package com.sjm.sjmsdk;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.ClipData;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.webkit.ValueCallback;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.sigmob.sdk.base.h;
import com.sigmob.sdk.base.j;
import com.sjm.sjmdaly.R$id;
import com.sjm.sjmdaly.R$layout;
import com.sjm.sjmsdk.js.LollipopFixedWebView;
import com.sjm.sjmsdk.js.SjmJSAdSdk;
import com.sjm.sjmsdk.js.SjmJSAppSdk;
import com.sjm.sjmsdk.js.SjmJSSdk;
import com.windmill.sdk.WMConstants;
import java.util.HashMap;
import q3.b;

public class SjmGameActivity extends AppCompatActivity {
    private static final String TAG = SjmSdkManager.class.getSimpleName();
    private ActionBar actionBar;
    public boolean isGoBack = false;
    private long resumeTime = 0;
    private LollipopFixedWebView webView;
    public b webViewSetting;

    private void gameExit(Boolean bool) {
        Intent intent = new Intent();
        intent.setAction("SjmSDK_Message");
        intent.putExtra("event", "gameExit");
        sendBroadcast(intent);
        if (bool.booleanValue()) {
            return;
        }
        finish();
    }

    @TargetApi(21)
    private void onActivityResultAboveL(int i, int i5, Intent intent) {
        Uri[] uriArr;
        b bVar = this.webViewSetting;
        if (i != 12 || bVar.e == null) {
            return;
        }
        if (i5 != -1 || intent == null) {
            uriArr = null;
        } else {
            String dataString = intent.getDataString();
            ClipData clipData = intent.getClipData();
            if (clipData != null) {
                uriArr = new Uri[clipData.getItemCount()];
                for (int i6 = 0; i6 < clipData.getItemCount(); i6++) {
                    uriArr[i6] = clipData.getItemAt(i6).getUri();
                }
            } else {
                uriArr = null;
            }
            if (dataString != null) {
                uriArr = new Uri[]{Uri.parse(dataString)};
            }
        }
        this.webViewSetting.e.onReceiveValue(uriArr);
        this.webViewSetting.e = null;
    }

    public void onActivityResult(int i, int i5, Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i5, intent);
        b bVar = this.webViewSetting;
        if (i == 12) {
            if (bVar.d == null && bVar.e == null) {
                return;
            }
            Uri data = (intent == null || i5 != -1) ? null : intent.getData();
            b bVar2 = this.webViewSetting;
            if (bVar2.e != null) {
                onActivityResultAboveL(i, i5, intent);
                return;
            }
            ValueCallback<Uri> valueCallback = bVar2.d;
            if (valueCallback != null) {
                valueCallback.onReceiveValue(data);
                this.webViewSetting.d = null;
            }
        }
    }

    @SuppressLint({"JavascriptInterface"})
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R$layout.sjm_activity_game);
        ActionBar supportActionBar = getSupportActionBar();
        this.actionBar = supportActionBar;
        if (supportActionBar != null) {
            supportActionBar.setHomeButtonEnabled(true);
            this.actionBar.setDisplayHomeAsUpEnabled(true);
        }
        setTitle("");
        this.webView = (LollipopFixedWebView) findViewById(R$id.sjm_gm_webView);
        b bVar = new b();
        this.webViewSetting = bVar;
        bVar.b(this, this.webView);
        Bundle extras = getIntent().getExtras();
        String string = extras.getString("uId");
        String string2 = extras.getString("uName");
        String string3 = extras.getString("uAvatar");
        int i = extras.getInt("uIntegral");
        extras.getString(j.m);
        String string4 = extras.getString("url");
        String string5 = extras.getString("adId");
        extras.getString(WMConstants.APP_ID);
        extras.getString("ptype");
        SjmUser sjmUser = new SjmUser(string, string2, string3, i, extras.getString("deviceid"));
        sjmUser.ext = string5;
        this.webView.addJavascriptInterface(new SjmJSSdk().setJSSDKCallBack(this, this.webView, sjmUser), "SjmJSSdk");
        this.webView.addJavascriptInterface(new SjmJSAdSdk().setJSSDKCallBack(this, this.webView, sjmUser), "SjmJSAdSdk");
        this.webView.addJavascriptInterface(new SjmJSAppSdk().setJSSDKCallBack(this, this.webView, sjmUser), "SjmJSAppSdk");
        new HashMap().put(h.b, string4);
        this.webView.loadUrl(string4);
    }

    public void onDestroy() {
        LollipopFixedWebView lollipopFixedWebView = this.webView;
        if (lollipopFixedWebView != null) {
            lollipopFixedWebView.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
            ((ViewGroup) this.webView.getParent()).removeView(this.webView);
            this.webView.destroy();
            this.webView = null;
        }
        super.onDestroy();
        try {
            SjmSdkManager.instance().onPause(this);
        } catch (Throwable unused) {
        }
    }

    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4) {
            if (this.webView.canGoBack()) {
                this.isGoBack = true;
                this.resumeTime = System.currentTimeMillis();
                this.webView.goBack();
                return true;
            }
            gameExit(Boolean.TRUE);
        }
        return super.onKeyDown(i, keyEvent);
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
        }
        if (!this.webView.canGoBack()) {
            gameExit(Boolean.FALSE);
            return true;
        }
        this.isGoBack = true;
        this.webView.goBack();
        return true;
    }
}