lwb
2020-12-07 60c805f6f058cdf8ef1ff3c35e788c18cc7b58fb
9527 webview
9个文件已修改
93 ■■■■ 已修改文件
Channel/Android/gtgame/debug/libs/library-debug-gtgame.aar 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/gtgame/release/libs/library-release-gtgame.aar 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/test/debug/libs/library-debug-test.aar 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/test/release/libs/library-release-test.aar 补丁 | 查看 | 原始文档 | blame | 历史
SdkProject/app/src/main/java/com/secondworld/demo/MainActivity.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SdkProject/app/src/main/res/layout/activity_main.xml 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SdkProject/library/src/main/java/com/secondworld/sdk/GameActivity.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SdkProject/library/src/main/java/com/secondworld/sdk/utils/WebViewUtil.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SdkProject/library/src/main/res/layout/activity_main.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/gtgame/debug/libs/library-debug-gtgame.aar
Binary files differ
Channel/Android/gtgame/release/libs/library-release-gtgame.aar
Binary files differ
Channel/Android/test/debug/libs/library-debug-test.aar
Binary files differ
Channel/Android/test/release/libs/library-release-test.aar
Binary files differ
SdkProject/app/src/main/java/com/secondworld/demo/MainActivity.java
@@ -3,12 +3,14 @@
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.widget.RelativeLayout;
import com.secondworld.sdk.GTGameApp;
import com.secondworld.sdk.GameActivityProxy;
import com.secondworld.sdk.UnityMsgHandler;
import com.secondworld.sdk.utils.CodeU2A;
import com.secondworld.sdk.utils.LogUtil;
import com.secondworld.sdk.utils.WebViewUtil;
import org.json.JSONException;
import org.json.JSONObject;
@@ -28,6 +30,8 @@
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        RelativeLayout webContainer = findViewById(com.secondworld.sdk.R.id.webContainer);
        WebViewUtil.I.init(this, webContainer);
        try {
            if (proxyClass != null) {
                proxy = proxyClass.newInstance();
@@ -41,13 +45,13 @@
        addEvent();
    }
    private void addEvent()
    {
    private void addEvent() {
        findViewById(R.id.login).setOnClickListener((v ->
        {
            JSONObject json = new JSONObject();
            try {
                json.put("code", CodeU2A.PlatformLogin);
                json.put("code", CodeU2A.OpenWebView);
                json.put("url", "http://sydownload.secondworld.net.cn/xmzc/notice/noticeweb/notice_bt.html");
            } catch (JSONException e) {
                e.printStackTrace();
            }
@@ -59,17 +63,18 @@
            try {
                json.put("code", CodeU2A.PlatformPay);
                json.put("cpInfo", "com.sanxiagame.zmjgp099");
                json.put("orderId", System.currentTimeMillis()/1000+"");
                json.put("orderId", System.currentTimeMillis() / 1000 + "");
                json.put("sid", "1");
                json.put("roleID","test_role");
                json.put("title","goods_100");
                json.put("mount","0.01");
                json.put("roleID", "test_role");
                json.put("title", "goods_100");
                json.put("mount", "0.01");
            } catch (JSONException e) {
                e.printStackTrace();
            }
            UnityMsgHandler.onUnityMessage(json.toString());
        }));
    }
    @Override
    protected void onStart() {
        super.onStart();
SdkProject/app/src/main/res/layout/activity_main.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
@@ -7,18 +7,48 @@
    android:background="@color/black"
    android:gravity="center">
    <Button
        android:id="@+id/login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="login" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <Button
        android:id="@+id/pay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="pay" />
        <Button
            android:id="@+id/login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="24dp"
            android:text="login" />
</LinearLayout>
        <Button
            android:id="@+id/pay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="24dp"
            android:text="pay" />
    </LinearLayout>
    <RelativeLayout
        android:id="@+id/webContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true">
        <WebView
            android:id="@+id/webView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true" />
        <ImageButton
            android:id="@+id/btnWebClose"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@id/webView"
            android:layout_alignEnd="@id/webView"
            android:layout_marginTop="-13dp"
            android:layout_marginEnd="-13dp"
            android:background="@drawable/web_close" />
    </RelativeLayout>
</RelativeLayout>
SdkProject/library/src/main/java/com/secondworld/sdk/GameActivity.java
@@ -2,6 +2,7 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
SdkProject/library/src/main/java/com/secondworld/sdk/utils/WebViewUtil.java
@@ -1,23 +1,24 @@
package com.secondworld.sdk.utils;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import com.secondworld.sdk.GameActivity;
import com.secondworld.sdk.R;
public class WebViewUtil {
    public static WebViewUtil I;
    public static WebViewUtil I = new WebViewUtil();
    RelativeLayout webContainer;
    private WebView webView;
    private WebView btnClose;
    private ImageButton btnClose;
    private boolean isShow;
@@ -26,7 +27,7 @@
    }
    @SuppressLint("SetJavaScriptEnabled")
    public void init(GameActivity gameActivity, RelativeLayout webContainer) {
    public void init(Activity gameActivity, RelativeLayout webContainer) {
        this.webContainer = webContainer;
        webView = webContainer.findViewById(R.id.webView);
        btnClose = webContainer.findViewById(R.id.btnWebClose);
@@ -78,12 +79,12 @@
        if (!isValid())
            return;
        webView.loadUrl(url);
        isShow = true;
        if (!delay)
            show();
    }
    private void show() {
        isShow = true;
        webContainer.setVisibility(View.VISIBLE);
    }
SdkProject/library/src/main/res/layout/activity_main.xml
@@ -26,8 +26,10 @@
            android:id="@+id/btnWebClose"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignEnd="@id/webView"
            android:layout_alignTop="@id/webView"
            android:layout_alignEnd="@id/webView"
            android:layout_marginTop="-13dp"
            android:layout_marginEnd="-13dp"
            android:background="@drawable/web_close" />
    </RelativeLayout>