首页设备列表,添加设备

This commit is contained in:
fengjignqi
2026-05-19 16:40:34 +08:00
parent 182289f82d
commit 99e0ee56a5
24 changed files with 496 additions and 188 deletions

View File

@@ -82,4 +82,39 @@ public class ActivityManager {
}
}
}
/**
* 关闭指定tag的所有Activity
*
* @param tag 比如 add_device_flag
*/
public static void removeActivityByTag(String tag)
{
if(activitys == null || activitys.isEmpty()){
return;
}
//避免遍历时ConcurrentModificationException
Map<String, Activity> tempMap =
new HashMap<>(activitys);
for (Map.Entry<String, Activity> entry : tempMap.entrySet()) {
String key = entry.getKey();
Activity activity = entry.getValue();
if (key != null && key.contains(tag)) {
if (activity != null &&
!activity.isFinishing() &&
!activity.isDestroyed()) {
activity.finish();
}
activitys.remove(key);
}
}
}
}