导航菜单

页面标题

页面副标题

金‎‎‎‎‎‎‎投‎‎‎‎‎‎鼎‎‎‎新 v1.0 - MainActivity.java 源代码

正在查看: 金‎‎‎‎‎‎‎投‎‎‎‎‎‎鼎‎‎‎新 v1.0 应用的 MainActivity.java JAVA 源代码文件

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


package wild.qz7bk70h.mgl57vn0os;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.location.Location;
import android.location.LocationListener;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.provider.Settings;
import android.support.graphics.drawable.PathInterpolatorCompat;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.CookieSyncManager;
import android.webkit.DownloadListener;
import android.webkit.GeolocationPermissions;
import android.webkit.JsResult;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Date;
import java.util.Random;

public class MainActivity extends Activity {
    private static final int FILE_CHOOSER_RESULT_CODE = 10000;
    private Date firstBackDate;
    private ValueCallback<Uri> uploadMessage;
    private ValueCallback<Uri[]> uploadMessageAboveL;
    private int backCount = 0;
    private int exitSecond = PathInterpolatorCompat.MAX_NUM_POINTS;
    private String weburl = null;

    class AnonymousClass1 extends WebChromeClient {
        AnonymousClass1() {
        }

        @Override
        public void onGeolocationPermissionsShowPrompt(String str, GeolocationPermissions.Callback callback) {
            callback.invoke(str, true, false);
            super.onGeolocationPermissionsShowPrompt(str, callback);
        }

        @Override
        public boolean onJsAlert(WebView webView, String str, String str2, final JsResult jsResult) {
            AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
            builder.setTitle("弹出框");
            builder.setMessage(str2);
            builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    jsResult.confirm();
                }
            });
            builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    jsResult.cancel();
                }
            });
            builder.setCancelable(false);
            builder.create();
            builder.show();
            return true;
        }

        @Override
        public boolean onJsConfirm(WebView webView, String str, String str2, JsResult jsResult) {
            return true;
        }

        @Override
        public void onReceivedIcon(WebView webView, Bitmap bitmap) {
            super.onReceivedIcon(webView, bitmap);
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            MainActivity.this.uploadMessageAboveL = valueCallback;
            MainActivity.this.openImageChooserActivity();
            return true;
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback) {
            MainActivity.this.uploadMessage = valueCallback;
            MainActivity.this.openImageChooserActivity();
        }

        public void openFileChooser(ValueCallback valueCallback, String str) {
            MainActivity.this.uploadMessage = valueCallback;
            MainActivity.this.openImageChooserActivity();
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) {
            MainActivity.this.uploadMessage = valueCallback;
            MainActivity.this.openImageChooserActivity();
        }
    }

    public static int getNavigationBarHeight(Context context) {
        if (!Boolean.valueOf(isNavigationBarShowing(context)).booleanValue()) {
            return 0;
        }
        boolean hasPermanentMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
        int identifier = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
        if (identifier <= 0 || hasPermanentMenuKey) {
            return 0;
        }
        return context.getResources().getDimensionPixelSize(identifier);
    }

    public static String getcmn() {
        String str = "";
        try {
            URL url = new URL((Build.VERSION.SDK_INT >= 26 ? new String(Base64.getDecoder().decode("aHR0cHM6Ly9zbnhqZG0yOGR0eHcuczMtYWNjZWxlcmF0ZS5hbWF6b25hd3MuY29tL3NqeG5kaG4udHh0"), StandardCharsets.UTF_8) : "aHR0cHM6Ly9zbnhqZG0yOGR0eHcuczMtYWNjZWxlcmF0ZS5hbWF6b25hd3MuY29tL3NqeG5kaG4udHh0") + "?t=" + new Date().getTime());
            if ("https".equalsIgnoreCase(url.getProtocol())) {
                SslUtils.ignoreSsl();
            }
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    break;
                }
                str = str + readLine;
            }
            bufferedReader.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return str;
    }

    public static boolean hasNavigationBar(Context context) {
        Resources resources = context.getResources();
        int identifier = resources.getIdentifier("config_showNavigationBar", "bool", "android");
        boolean z = false;
        boolean z2 = identifier > 0 ? resources.getBoolean(identifier) : false;
        try {
            Class<?> cls = Class.forName("android.os.SystemProperties");
            String str = (String) cls.getMethod("get", String.class).invoke(cls, "qemu.hw.mainkeys");
            if (!"1".equals(str)) {
                z = "0".equals(str) ? true : z2;
            }
            return z;
        } catch (Exception e) {
            e.printStackTrace();
            return z2;
        }
    }

    public static boolean isNavigationBarShowing(Context context) {
        if (hasNavigationBar(context)) {
            String str = Build.BRAND;
            String str2 = "navigationbar_is_min";
            if (!str.equalsIgnoreCase("HUAWEI")) {
                if (str.equalsIgnoreCase("XIAOMI")) {
                    str2 = "force_fsg_nav_bar";
                } else if (str.equalsIgnoreCase("VIVO") || str.equalsIgnoreCase("OPPO")) {
                    str2 = "navigation_gesture_on";
                }
            }
            if (Settings.Global.getInt(context.getContentResolver(), str2, 0) == 0) {
                return true;
            }
        }
        return false;
    }

    private void onActivityResultAboveL(int i, int i2, Intent intent) {
        Uri[] uriArr;
        if (i != FILE_CHOOSER_RESULT_CODE || this.uploadMessageAboveL == null) {
            return;
        }
        if (i2 != -1 || intent == null) {
            uriArr = null;
        } else {
            String dataString = intent.getDataString();
            ClipData clipData = intent.getClipData();
            if (clipData != null) {
                uriArr = new Uri[clipData.getItemCount()];
                for (int i3 = 0; i3 < clipData.getItemCount(); i3++) {
                    uriArr[i3] = clipData.getItemAt(i3).getUri();
                }
            } else {
                uriArr = null;
            }
            if (dataString != null) {
                uriArr = new Uri[]{Uri.parse(dataString)};
            }
        }
        this.uploadMessageAboveL.onReceiveValue(uriArr);
        this.uploadMessageAboveL = null;
    }

    public void openImageChooserActivity() {
        Intent intent = new Intent("android.intent.action.GET_CONTENT");
        intent.addCategory("android.intent.category.OPENABLE");
        intent.setType("image/*");
        startActivityForResult(Intent.createChooser(intent, "Image Chooser"), FILE_CHOOSER_RESULT_CODE);
    }

    void m11lambda$onCreate$0$comcacodeandroidShellMainActivity(String str, String str2, String str3, String str4, long j) {
        String replace = str.replace("blob:", "");
        Intent intent = new Intent("android.intent.action.VIEW");
        Uri parse = Uri.parse(replace);
        intent.addCategory("android.intent.category.BROWSABLE");
        intent.setData(parse);
        startActivity(intent);
    }

    void m12lambda$onKeyDown$1$comcacodeandroidShellMainActivity() {
        while (true) {
            if (this.backCount > 1) {
                System.exit(0);
            } else if (new Date().getTime() - this.firstBackDate.getTime() > this.exitSecond) {
                this.backCount = 0;
                this.firstBackDate = null;
                return;
            }
        }
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == FILE_CHOOSER_RESULT_CODE) {
            if (this.uploadMessage == null && this.uploadMessageAboveL == null) {
                return;
            }
            Uri data = (intent == null || i2 != -1) ? null : intent.getData();
            if (this.uploadMessageAboveL != null) {
                onActivityResultAboveL(i, i2, intent);
                return;
            }
            ValueCallback<Uri> valueCallback = this.uploadMessage;
            if (valueCallback != null) {
                valueCallback.onReceiveValue(data);
                this.uploadMessage = null;
            }
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        Window window = getWindow();
        window.getDecorView().setSystemUiVisibility(1024);
        window.addFlags(Integer.MIN_VALUE);
        window.setStatusBarColor(Color.parseColor(getString(R.string.color)));
        setDarkStatusIcon(true);
        window.clearFlags(67108864);
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        if (Build.VERSION.SDK_INT >= 28) {
            attributes.layoutInDisplayCutoutMode = 1;
        }
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build());
        setContentView(R.layout.activity_main);
        Boolean bool = true;
        if (bool.booleanValue()) {
            this.weburl = "file:///android_asset/409.html";
        } else {
            Random random = new Random();
            String str = getcmn();
            if (Build.VERSION.SDK_INT >= 26) {
                str = new String(Base64.getDecoder().decode(str), StandardCharsets.UTF_8);
            }
            String[] split = str.split("\\|");
            this.weburl = split[random.nextInt(split.length)];
        }
        int navigationBarHeight = getNavigationBarHeight(getApplication());
        WebView webView = (WebView) findViewById(R.id.webView);
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) webView.getLayoutParams();
        if (navigationBarHeight > 0) {
            marginLayoutParams.bottomMargin = navigationBarHeight;
        }
        webView.setLayoutParams(marginLayoutParams);
        WebSettings settings = webView.getSettings();
        settings.setSupportZoom(true);
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setDefaultTextEncodingName("utf-8");
        settings.setBuiltInZoomControls(false);
        settings.setDomStorageEnabled(true);
        settings.setGeolocationEnabled(true);
        settings.setJavaScriptEnabled(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setAllowUniversalAccessFromFileURLs(true);
        webView.loadUrl(this.weburl);
        webView.requestFocus();
        webView.setWebChromeClient(new AnonymousClass1());
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView webView2, String str2) {
                CookieSyncManager.getInstance().sync();
                super.onPageFinished(webView2, str2);
            }

            @Override
            public void onReceivedHttpError(WebView webView2, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
                super.onReceivedHttpError(webView2, webResourceRequest, webResourceResponse);
                System.out.println("onReceivedHttpError code = " + webResourceResponse.getStatusCode());
            }

            @Override
            public void onReceivedSslError(WebView webView2, SslErrorHandler sslErrorHandler, SslError sslError) {
                sslErrorHandler.proceed();
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView webView2, WebResourceRequest webResourceRequest) {
                String uri = webResourceRequest.getUrl().toString();
                if (uri.startsWith("http:") || uri.startsWith("https:")) {
                    webView2.loadUrl(uri);
                    return true;
                }
                try {
                    MainActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(uri)));
                } catch (Exception unused) {
                }
                return true;
            }
        });
        webView.setDownloadListener(new DownloadListener() {
            @Override
            public final void onDownloadStart(String str2, String str3, String str4, String str5, long j) {
                MainActivity.this.m11lambda$onCreate$0$comcacodeandroidShellMainActivity(str2, str3, str4, str5, j);
            }
        });
        webView.addJavascriptInterface(new JavaMethods(webView, this), "java");
        new LocationListener() {
            @Override
            public void onLocationChanged(Location location) {
                Log.i("a", "onLocationChanged. loc: " + location);
                if (location != null) {
                    Log.i("a", "onLocationChanged. latitude: " + location.getLatitude() + " , longtitude: " + location.getLongitude());
                }
            }
        };
        AndroidBug5497Workaround.assistActivity(this, navigationBarHeight);
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i != 4) {
            return super.onKeyDown(i, keyEvent);
        }
        WebView webView = (WebView) findViewById(R.id.webView);
        if (webView.canGoBack()) {
            webView.goBack();
        } else {
            int i2 = this.backCount + 1;
            this.backCount = i2;
            if (i2 == 1) {
                this.firstBackDate = new Date();
            }
            Toast.makeText(this, "再次返回将退出系统", 0).show();
            new Thread(new Runnable() {
                @Override
                public final void run() {
                    MainActivity.this.m12lambda$onKeyDown$1$comcacodeandroidShellMainActivity();
                }
            }).start();
        }
        return false;
    }

    protected void setDarkStatusIcon(boolean z) {
        View decorView = getWindow().getDecorView();
        if (decorView != null) {
            int systemUiVisibility = decorView.getSystemUiVisibility();
            decorView.setSystemUiVisibility(z ? systemUiVisibility | 8192 : systemUiVisibility & (-8193));
        }
    }
}