From 8adb5e06a5fcfad9a634944c0d65fc70c5c2527f Mon Sep 17 00:00:00 2001
From: Tong <1025782220@qq.com>
Date: 星期二, 19 四月 2022 10:12:57 +0800
Subject: [PATCH] 去掉依赖库

---
 HDLSDK/hdl-common/src/main/java/com/hdl/sdk/common/event/EventDispatcher.java |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/HDLSDK/hdl-common/src/main/java/com/hdl/sdk/common/event/EventDispatcher.java b/HDLSDK/hdl-common/src/main/java/com/hdl/sdk/common/event/EventDispatcher.java
index a409121..ca3ca7d 100644
--- a/HDLSDK/hdl-common/src/main/java/com/hdl/sdk/common/event/EventDispatcher.java
+++ b/HDLSDK/hdl-common/src/main/java/com/hdl/sdk/common/event/EventDispatcher.java
@@ -1,9 +1,7 @@
 package com.hdl.sdk.common.event;
 
 
-
-import android.support.annotation.NonNull;
-import android.support.v4.util.ArrayMap;
+import android.util.ArrayMap;
 
 import com.hdl.sdk.common.utils.LogUtils;
 import com.hdl.sdk.common.utils.ThreadToolUtils;
@@ -11,6 +9,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
 
 
@@ -22,9 +21,9 @@
 
     private static final List<EventListener> ALL_TOPICS_EVENT = new ArrayList<>();//鎵�鏈変富棰樻秷鎭�
 
-    private static final ArrayMap<Object, List<EventListener>> EVENT = new ArrayMap<>();
+    private static final ConcurrentHashMap<Object, List<EventListener>> EVENT = new ConcurrentHashMap<>();
 
-    private static final ArrayMap<EventListener, Integer> TYPE = new ArrayMap<>();
+    private static final ConcurrentHashMap<EventListener, Integer> TYPE = new ConcurrentHashMap<>();
 
     private static final int MAIN_TYPE = 0;
     private static final int IO_TYPE = 1;
@@ -63,7 +62,7 @@
         }
     }
 
-    public  void registerIo(Object tag, EventListener listener) {
+    public void registerIo(Object tag, EventListener listener) {
         synchronized (this) {
             LogUtils.i("娉ㄥ唽涓婚锛�" + tag);
             if (tag == null) return;
@@ -83,7 +82,7 @@
         }
     }
 
-    public  void remove(Object tag) {
+    public void remove(Object tag) {
         synchronized (this) {
             if (tag == null) {
                 return;
@@ -106,7 +105,7 @@
         }
     }
 
-    public  void remove(Object tag, EventListener listener) {
+    public void remove(Object tag, EventListener listener) {
         synchronized (this) {
             try {
                 if (tag == null || listener == null) {
@@ -126,7 +125,7 @@
         }
     }
 
-    public synchronized void post(Object tag, @NonNull Object o) {
+    public synchronized void post(Object tag, Object o) {
         if (tag == null) {
             LogUtils.i("post tag涓虹┖");
             return;
@@ -174,17 +173,18 @@
                     });
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             LogUtils.e("post寮傚父2锛�" + e.getMessage());
         }
     }
 
     /**
      * 娉ㄥ唽鎵�鏈変富棰樻秷鎭殑鐩戝惉
+     *
      * @param listener
      */
     public synchronized void registerAllTopicsListener(EventListener listener) {
-        if(listener==null){
+        if (listener == null) {
             return;
         }
         try {
@@ -192,13 +192,14 @@
                 ALL_TOPICS_EVENT.add(listener);
             }
             TYPE.put(listener, MAIN_TYPE);
-        }catch (Exception e){
+        } catch (Exception e) {
             LogUtils.e("registerAllTopicsListener锛�" + e.getMessage());
         }
     }
 
     /**
      * 鍙栨秷鎵�鏈変富棰樻秷鎭殑鐩戝惉
+     *
      * @param listener
      */
     public synchronized void removeAllTopicsListener(EventListener listener) {
@@ -207,7 +208,7 @@
                 @Override
                 public void run() {
                     try {
-                        if(listener==null){
+                        if (listener == null) {
                             return;
                         }
                         if (ALL_TOPICS_EVENT != null && !ALL_TOPICS_EVENT.isEmpty()) {

--
Gitblit v1.8.0