protected boolean handleOnDanmakuConfigChanged( DanmakuGlobalConfig config, DanmakuConfigTag tag, Object[] values) { boolean handled = false; if (tag == null || DanmakuConfigTag.MAXIMUM_NUMS_IN_SCREEN.equals(tag)) { handled = true; } else if (DanmakuConfigTag.DUPLICATE_MERGING_ENABLED.equals(tag)) { Boolean enable = (Boolean) values[0]; if (enable != null) { if (enable) { DanmakuFilters.getDefault().registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER); } else { DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_DUPLICATE_FILTER); } handled = true; } } else if (DanmakuConfigTag.SCALE_TEXTSIZE.equals(tag) || DanmakuConfigTag.SCROLL_SPEED_FACTOR.equals(tag)) { requestClearRetainer(); handled = false; } else if (DanmakuConfigTag.MAXIMUN_LINES.equals(tag) || DanmakuConfigTag.OVERLAPPING_ENABLE.equals(tag)) { if (mRenderer != null) { mRenderer.setVerifierEnabled( DanmakuGlobalConfig.DEFAULT.isPreventOverlappingEnabled() || DanmakuGlobalConfig.DEFAULT.isMaxLinesLimited()); } handled = true; } return handled; }
public DrawTask(DanmakuTimer timer, AbsDisplayer<?> disp, TaskListener taskListener) { mTaskListener = taskListener; mRenderer = new DanmakuRenderer(); mRenderer.setVerifierEnabled( DanmakuGlobalConfig.DEFAULT.isPreventOverlappingEnabled() || DanmakuGlobalConfig.DEFAULT.isMaxLinesLimited()); mDisp = disp; initTimer(timer); Boolean enable = DanmakuGlobalConfig.DEFAULT.isDuplicateMergingEnabled(); if (enable != null) { if (enable) { DanmakuFilters.getDefault().registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER); } else { DanmakuFilters.getDefault().unregisterFilter(DanmakuFilters.TAG_DUPLICATE_FILTER); } } }
@Override public void quit() { DanmakuGlobalConfig.DEFAULT.unregisterAllConfigChangedCallbacks(); if (mRenderer != null) mRenderer.release(); }
@Override public void start() { DanmakuGlobalConfig.DEFAULT.registerConfigChangedCallback(mConfigChangedCallback); }