/**
  * 设置弹幕滚动速度系数,只对滚动弹幕有效
  *
  * @param p
  * @return
  */
 public DanmakuGlobalConfig setScrollSpeedFactor(float p) {
   if (scrollSpeedFactor != p) {
     scrollSpeedFactor = p;
     DanmakuFactory.updateDurationFactor(p);
     GlobalFlagValues.updateMeasureFlag();
     GlobalFlagValues.updateVisibleFlag();
     notifyConfigureChanged(DanmakuConfigTag.SCROLL_SPEED_FACTOR, p);
   }
   return this;
 }
 public DanmakuGlobalConfig setScaleTextSize(float p) {
   if (scaleTextSize != p) {
     scaleTextSize = p;
     AndroidDisplayer.clearTextHeightCache();
     GlobalFlagValues.updateMeasureFlag();
     GlobalFlagValues.updateVisibleFlag();
     notifyConfigureChanged(DanmakuConfigTag.SCALE_TEXTSIZE, p);
   }
   isTextScaled = (scaleTextSize != 1f);
   return this;
 }
Пример #3
0
 @Override
 public void seek(long mills) {
   reset();
   //        requestClear();
   GlobalFlagValues.updateVisibleFlag();
   mStartRenderTime = mills < 1000 ? 0 : mills;
 }
 /**
  * 设置是否启用合并重复弹幕
  *
  * @param enable
  * @return
  */
 public DanmakuGlobalConfig setDuplicateMergingEnabled(boolean enable) {
   if (mDuplicateMergingEnable != enable) {
     mDuplicateMergingEnable = enable;
     GlobalFlagValues.updateFilterFlag();
     notifyConfigureChanged(DanmakuConfigTag.DUPLICATE_MERGING_ENABLED, enable);
   }
   return this;
 }
 /**
  * 添加屏蔽用户
  *
  * @param ids
  * @return
  */
 public DanmakuGlobalConfig addUserIdBlackList(Integer... ids) {
   if (ids == null || ids.length == 0) {
     return this;
   }
   Collections.addAll(mUserIdBlackList, ids);
   setFilterData(DanmakuFilters.TAG_USER_ID_FILTER, mUserIdBlackList);
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.USER_ID_BLACK_LIST, mUserIdBlackList);
   return this;
 }
 /**
  * 设置是否显示特殊弹幕
  *
  * @param visible
  */
 public DanmakuGlobalConfig setSpecialDanmakuVisibility(boolean visible) {
   setDanmakuVisible(visible, BaseDanmaku.TYPE_SPECIAL);
   setFilterData(DanmakuFilters.TAG_TYPE_DANMAKU_FILTER, mFilterTypes);
   GlobalFlagValues.updateFilterFlag();
   if (SecialDanmakuVisibility != visible) {
     SecialDanmakuVisibility = visible;
     notifyConfigureChanged(DanmakuConfigTag.SPECIAL_DANMAKU_VISIBILITY, visible);
   }
   return this;
 }
 /**
  * 添加屏蔽用户
  *
  * @param hashes
  * @return
  */
 public DanmakuGlobalConfig addUserHashBlackList(String... hashes) {
   if (hashes == null || hashes.length == 0) {
     return this;
   }
   Collections.addAll(mUserHashBlackList, hashes);
   setFilterData(DanmakuFilters.TAG_USER_HASH_FILTER, mUserHashBlackList);
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.USER_HASH_BLACK_LIST, mUserHashBlackList);
   return this;
 }
 /**
  * 设置防弹幕重叠
  *
  * @param pairs map<K,V> 设置null恢复默认设置,默认为允许重叠 K =
  *     (BaseDanmaku.TYPE_SCROLL_RL|BaseDanmaku.TYPE_SCROLL_LR|BaseDanmaku.TYPE_FIX_TOP|BaseDanmaku.TYPE_FIX_BOTTOM)
  *     V = true|false 是否重叠
  * @return
  */
 public DanmakuGlobalConfig preventOverlapping(Map<Integer, Boolean> pairs) {
   mIsPreventOverlappingEnabled = (pairs != null);
   if (pairs == null) {
     DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_OVERLAPPING_FILTER, false);
   } else {
     setFilterData(DanmakuFilters.TAG_OVERLAPPING_FILTER, pairs, false);
   }
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.OVERLAPPING_ENABLE, pairs);
   return this;
 }
 /**
  * 设置最大显示行数
  *
  * @param pairs map<K,V> 设置null取消行数限制 K =
  *     (BaseDanmaku.TYPE_SCROLL_RL|BaseDanmaku.TYPE_SCROLL_LR|BaseDanmaku.TYPE_FIX_TOP|BaseDanmaku.TYPE_FIX_BOTTOM)
  *     V = 最大行数
  * @return
  */
 public DanmakuGlobalConfig setMaximumLines(Map<Integer, Integer> pairs) {
   mIsMaxLinesLimited = (pairs != null);
   if (pairs == null) {
     DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_MAXIMUN_LINES_FILTER, false);
   } else {
     setFilterData(DanmakuFilters.TAG_MAXIMUN_LINES_FILTER, pairs, false);
   }
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.MAXIMUN_LINES, pairs);
   return this;
 }
 /**
  * 设置色彩过滤弹幕白名单
  *
  * @param colors
  * @return
  */
 public DanmakuGlobalConfig setColorValueWhiteList(Integer... colors) {
   mColorValueWhiteList.clear();
   if (colors == null || colors.length == 0) {
     DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_TEXT_COLOR_DANMAKU_FILTER);
   } else {
     Collections.addAll(mColorValueWhiteList, colors);
     setFilterData(DanmakuFilters.TAG_TEXT_COLOR_DANMAKU_FILTER, mColorValueWhiteList);
   }
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.COLOR_VALUE_WHITE_LIST, mColorValueWhiteList);
   return this;
 }
 /**
  * 设置屏蔽弹幕用户hash
  *
  * @param hashes
  * @return
  */
 public DanmakuGlobalConfig setUserHashBlackList(String... hashes) {
   mUserHashBlackList.clear();
   if (hashes == null || hashes.length == 0) {
     DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_USER_HASH_FILTER);
   } else {
     Collections.addAll(mUserHashBlackList, hashes);
     setFilterData(DanmakuFilters.TAG_USER_HASH_FILTER, mUserHashBlackList);
   }
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.USER_HASH_BLACK_LIST, mUserHashBlackList);
   return this;
 }
 public DanmakuGlobalConfig removeUserIdBlackList(Integer... ids) {
   if (ids == null || ids.length == 0) {
     return this;
   }
   for (Integer id : ids) {
     mUserIdBlackList.remove(id);
   }
   setFilterData(DanmakuFilters.TAG_USER_ID_FILTER, mUserIdBlackList);
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.USER_ID_BLACK_LIST, mUserIdBlackList);
   return this;
 }
 /**
  * 设置屏蔽弹幕用户id , 0 表示游客弹幕
  *
  * @param ids
  * @return
  */
 public DanmakuGlobalConfig setUserIdBlackList(Integer... ids) {
   mUserIdBlackList.clear();
   if (ids == null || ids.length == 0) {
     DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_USER_ID_FILTER);
   } else {
     Collections.addAll(mUserIdBlackList, ids);
     setFilterData(DanmakuFilters.TAG_USER_ID_FILTER, mUserIdBlackList);
   }
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.USER_ID_BLACK_LIST, mUserIdBlackList);
   return this;
 }
 public DanmakuGlobalConfig removeUserHashBlackList(String... hashes) {
   if (hashes == null || hashes.length == 0) {
     return this;
   }
   for (String hash : hashes) {
     mUserHashBlackList.remove(hash);
   }
   setFilterData(DanmakuFilters.TAG_USER_HASH_FILTER, mUserHashBlackList);
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.USER_HASH_BLACK_LIST, mUserHashBlackList);
   return this;
 }
 /**
  * 设置是否屏蔽游客弹幕
  *
  * @param block true屏蔽,false不屏蔽
  * @return
  */
 public DanmakuGlobalConfig blockGuestDanmaku(boolean block) {
   if (mBlockGuestDanmaku != block) {
     mBlockGuestDanmaku = block;
     if (block) {
       setFilterData(DanmakuFilters.TAG_GUEST_FILTER, block);
     } else {
       DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_GUEST_FILTER);
     }
     GlobalFlagValues.updateFilterFlag();
     notifyConfigureChanged(DanmakuConfigTag.BLOCK_GUEST_DANMAKU, block);
   }
   return this;
 }
 /**
  * 设置同屏弹幕密度 -1自动 0无限制
  *
  * @param maxSize
  * @return
  */
 public DanmakuGlobalConfig setMaximumVisibleSizeInScreen(int maxSize) {
   maximumNumsInScreen = maxSize;
   // 无限制
   if (maxSize == 0) {
     DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_QUANTITY_DANMAKU_FILTER);
     DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_ELAPSED_TIME_FILTER);
     notifyConfigureChanged(DanmakuConfigTag.MAXIMUM_NUMS_IN_SCREEN, maxSize);
     return this;
   }
   // 自动调整
   if (maxSize == -1) {
     DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_QUANTITY_DANMAKU_FILTER);
     DanmakuFilters.getDefault().registerFilter(DanmakuFilters.TAG_ELAPSED_TIME_FILTER);
     notifyConfigureChanged(DanmakuConfigTag.MAXIMUM_NUMS_IN_SCREEN, maxSize);
     return this;
   }
   setFilterData(DanmakuFilters.TAG_QUANTITY_DANMAKU_FILTER, maxSize);
   GlobalFlagValues.updateFilterFlag();
   notifyConfigureChanged(DanmakuConfigTag.MAXIMUM_NUMS_IN_SCREEN, maxSize);
   return this;
 }
Пример #17
0
 protected void loadDanmakus(BaseDanmakuParser parser) {
   danmakuList = parser.setDisplayer(mDisp).setTimer(mTimer).getDanmakus();
   GlobalFlagValues.resetAll();
 }
Пример #18
0
 @Override
 public void clearDanmakusOnScreen(long currMillis) {
   reset();
   GlobalFlagValues.updateVisibleFlag();
   mStartRenderTime = currMillis;
 }