Пример #1
0
 @Override
 public void addDanmaku(BaseDanmaku item) {
   if (danmakuList == null) return;
   synchronized (danmakuList) {
     if (item.isLive) {
       removeUnusedLiveDanmakusIn(5);
     }
     item.setTimer(mTimer);
     item.index = danmakuList.size();
     danmakuList.addItem(item);
   }
 }
Пример #2
0
 @Override
 public synchronized void addDanmaku(BaseDanmaku item) {
   if (danmakuList == null) return;
   boolean added = false;
   if (item.isLive) {
     removeUnusedLiveDanmakusIn(10);
   }
   item.index = danmakuList.size();
   if (mLastBeginMills <= item.time && item.time <= mLastEndMills) {
     synchronized (danmakus) {
       added = danmakus.addItem(item);
     }
   } else if (item.isLive) {
     mLastBeginMills = mLastEndMills = 0;
   }
   synchronized (danmakuList) {
     added = danmakuList.addItem(item);
   }
   if (added && mTaskListener != null) {
     mTaskListener.onDanmakuAdd(item);
   }
 }