From 32af30cdbb9e750a1bd059cacf2d8c8c37776dad Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 31 七月 2025 14:48:57 +0800
Subject: [PATCH] 2025年07月31日14:48:56

---
 app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java b/app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java
index 7429be0..b04e5bc 100644
--- a/app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java
+++ b/app/src/main/java/com/hdl/photovoltaic/utils/AppManagerUtils.java
@@ -115,6 +115,26 @@
     }
 
     /**
+     * Activity鏄惁鍦ㄩ《閮�
+     */
+    public boolean existsTopActivity(Class<?>... args) {
+        try {
+            if (activityStack == null || activityStack.size() == 0) {
+                return false;
+            }
+            final int index = activityStack.size() - 1;
+            for (Class<?> cls : args) {
+                if (activityStack.get(index).getClass().equals(cls)) {
+                    return true;
+                }
+            }
+        } catch (Exception e) {
+            return false;
+        }
+        return false;
+    }
+
+    /**
      * 鎸囧畾涓�涓被鍚�,浠庢寚瀹氱被鍚嶅紑濮嬬Щ闄ゅ悗闈㈡墍鏈堿ctivity
      *
      * @param className   Activity-绫诲悕(activity.getClass().getName())
@@ -154,7 +174,7 @@
     }
 
 
-    public  boolean existsActivity(Context activity,String className){
+    public boolean existsActivity(Context activity, String className) {
         boolean isLoginActivity = false;
         // 鑾峰彇褰撳墠Activity鐨勫垪琛�
         ActivityManager activityManager = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
@@ -168,8 +188,9 @@
                 break;
             }
         }
-        return  isLoginActivity;
+        return isLoginActivity;
     }
+
 
     /**
      * 缁撴潫鎵�鏈堿ctivity
@@ -208,8 +229,6 @@
         }
         return null;
     }
-
-
 
 
     /**

--
Gitblit v1.8.0