From 7e2df20ccc7cdfb528d309369460a4f3d66afdf1 Mon Sep 17 00:00:00 2001 From: liuxue <q3213421wrwqr> Date: 星期四, 29 七月 2021 17:51:09 +0800 Subject: [PATCH] 0000 增加bt3 quick android 和 ios 的 SDK --- Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 42 insertions(+), 8 deletions(-) diff --git a/Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java b/Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java index 786d5ef..5552449 100644 --- a/Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java +++ b/Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java @@ -7,12 +7,14 @@ import android.content.pm.PackageManager; import android.content.res.Configuration; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Process; import android.provider.Settings; import android.support.v4.content.PermissionChecker; import android.view.View; import android.widget.FrameLayout; +import android.widget.RelativeLayout; import com.unity3d.player.UnityPlayerActivity; @@ -22,6 +24,10 @@ public static boolean isForeground = false; // 鍚敤6.0浠ヤ笂鏉冮檺鍥炶皟code // private static final int CODE_REQUEST_PERMISSION = 1000; + + private RelativeLayout m_MainContainer; + private int mType; + private boolean isNotch = false; @Override protected void onCreate(Bundle savedInstanceState) @@ -33,6 +39,33 @@ setContentView(R.layout.activity_main); + m_MainContainer = (RelativeLayout) findViewById(R.id.main_container); + + String _brand = NotchPhoneUtil.getDeviceBrand(); + if (_brand.toUpperCase().contains("VIVO")) + { + isNotch = NotchPhoneUtil.HasNotchVivo(MainActivity.this); + mType = 1; + } + else if (_brand.toUpperCase().contains("HUAWEI") + || _brand.toUpperCase().contains("HONOR")) + { +// isNotch = NotchPhoneUtil.hasNotchAtHuawei(this);; +// mType = 2; + } + else if (_brand.toUpperCase().contains("OPPO")) + { + isNotch = NotchPhoneUtil.HasNotchOPPO(MainActivity.this); + mType = 3; + } + else if (_brand.toUpperCase().contains("XIAOMI")) + { + isNotch = NotchPhoneUtil.HasNotchXiaoMi(); + mType = 4; + } + + NotchPhoneUtil.onConfigurationChanged(this, isNotch, mType, m_MainContainer); + FrameLayout _frameLayout = (FrameLayout) findViewById(R.id.unity_view); View unityView = mUnityPlayer.getView(); _frameLayout.addView(unityView); @@ -41,11 +74,17 @@ } @Override + public void onWindowFocusChanged(boolean b) + { + super.onWindowFocusChanged(b); + H2EngineSDK.onWindowFocusChanged(b); + } + + @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); H2EngineSDK.onNewIntent(this, intent); - LogUtil.i(TAG, "onNewIntent"); } @Override @@ -58,10 +97,11 @@ @Override public void onConfigurationChanged(Configuration newConfig) { + NotchPhoneUtil.onConfigurationChanged(this, isNotch, mType, m_MainContainer); + H2EngineSDK.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig); - LogUtil.i(TAG, "onConfigurationChanged"); } @Override @@ -70,7 +110,6 @@ H2EngineSDK.onStart(this); super.onStart(); - LogUtil.i(TAG, "onStart"); } @Override @@ -80,7 +119,6 @@ H2EngineSDK.onStop(this); super.onStop(); - LogUtil.i(TAG, "onStop"); } @Override @@ -90,7 +128,6 @@ H2EngineSDK.onResume(this); super.onResume(); - LogUtil.i(TAG, "onResume"); // 妫�娴嬫湰鍦板瓨鍌ㄦ潈闄愭槸鍚︽湁, 娌℃湁鐨勮瘽瑕佹彁绀虹敤鎴� if (PermissionChecker.checkPermission(this, @@ -143,7 +180,6 @@ H2EngineSDK.onPause(this); super.onPause(); - LogUtil.i(TAG, "onPause"); } @Override @@ -152,7 +188,6 @@ H2EngineSDK.onDestroy(this); super.onDestroy(); - LogUtil.i(TAG, "onDestroy"); } @Override @@ -161,7 +196,6 @@ H2EngineSDK.onRestart(this); super.onRestart(); - LogUtil.i(TAG, "onRestart"); } } -- Gitblit v1.8.0