From 2ad73c771ae241028763746e958b362683ad112f Mon Sep 17 00:00:00 2001 From: little-cute233 Date: Mon, 22 Jul 2024 10:44:16 +0800 Subject: [PATCH] Update BiddingSplashActivity.java updata bidding splash --- .../hms/ads/sdk/BiddingSplashActivity.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/huawei/hms/ads/sdk/BiddingSplashActivity.java b/app/src/main/java/com/huawei/hms/ads/sdk/BiddingSplashActivity.java index 181b114..c5a8bde 100644 --- a/app/src/main/java/com/huawei/hms/ads/sdk/BiddingSplashActivity.java +++ b/app/src/main/java/com/huawei/hms/ads/sdk/BiddingSplashActivity.java @@ -46,6 +46,9 @@ public class BiddingSplashActivity extends BaseActivity { private SplashAd splashAd; + // 返回键标志位 按返回键退出时应用不被重新拉起,但是在展示广告时下拉通知栏仍然需要正常跳转 + private boolean hasPaused = false; + @Override protected void onCreate(Bundle savedInstanceState) { // set full screen @@ -122,16 +125,18 @@ private void showSplashAd() { } @Override + // 从其他页面回到开屏页面时调用,进入应用 protected void onRestart() { - // 从其他页面回到开屏页面时调用,进入应用 - Log.d(TAG, "onRestart"); super.onRestart(); + Log.d(TAG, "onRestart"); + hasPaused = false; jump(); } @Override protected void onStop() { Log.d(TAG, "onStop"); + hasPaused = true; super.onStop(); } @@ -198,8 +203,13 @@ private int getScreenOrientation() { } private void jump() { - startActivity(new Intent(BiddingSplashActivity.this, MainActivity.class)); - finish(); + Log.d(TAG, "jump hasPaused: " + hasPaused); + if(!hasPaused) { + hasPaused = true; + Log.d(TAG, "jump into application"); + startActivity(new Intent(BiddingSplashActivity.this, MainActivity.class)); + finish(); + } } private void showMsg(String msg) {