本文整理汇总了Java中master.flame.danmaku.danmaku.model.android.DanmakuContext类的典型用法代码示例。如果您正苦于以下问题:Java DanmakuContext类的具体用法?Java DanmakuContext怎么用?Java DanmakuContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DanmakuContext类属于master.flame.danmaku.danmaku.model.android包,在下文中一共展示了DanmakuContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: needFilter
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
private boolean needFilter(BaseDanmaku danmaku, int orderInScreen, int totalSizeInScreen, DanmakuTimer timer, boolean fromCachingTask, DanmakuContext context) {
Log.v("XX", "QuantityDanmakuFilter needFilter mMaximumSize : " + this.mMaximumSize + " totalSizeInScreen : " + totalSizeInScreen + " orderInScreen : " + orderInScreen + " danmaku.isTimeOut() " + danmaku.isTimeOut() + " mMaximumSize : " + this.mMaximumSize + " isShown :" + danmaku.isShown());
if (this.mMaximumSize == 0) {
return true;
}
if (totalSizeInScreen < this.mMaximumSize || (this.mLastSkipped != null && danmaku.time - this.mLastSkipped.time > context.mDanmakuFactory.MAX_DANMAKU_DURATION / 4)) {
Log.v("xx", " QuantityDanmakuFilter not guolv2222 >>>>>>>>");
this.mLastSkipped = danmaku;
return false;
} else if (orderInScreen <= this.mMaximumSize || danmaku.isTimeOut()) {
this.mLastSkipped = danmaku;
Log.v("xx", " QuantityDanmakuFilter not guolv11111 >>>>>>>>");
return false;
} else {
Log.v("xx", " QuantityDanmakuFilter guolv >>>>>>>>");
return true;
}
}
示例2: needFilter
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
private boolean needFilter(BaseDanmaku danmaku, int orderInScreen,
int totalSizeInScreen, DanmakuTimer timer, boolean fromCachingTask, DanmakuContext context) {
if (mMaximumSize <= 0 || danmaku.getType() != BaseDanmaku.TYPE_SCROLL_RL) {
return false;
}
if (totalSizeInScreen < mMaximumSize || danmaku.isShown()
|| (mLastSkipped != null && (danmaku.time - mLastSkipped.time > context.mDanmakuFactory.MAX_DANMAKU_DURATION / 20))) {
mLastSkipped = danmaku;
return false;
}
if (orderInScreen > mMaximumSize && !danmaku.isTimeOut()) {
return true;
}
mLastSkipped = danmaku;
return false;
}
示例3: initDanmuConfig
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
/**
* 初始化配置
*/
private void initDanmuConfig() {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<Integer, Integer>();
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5); // 滚动弹幕最大显示5行
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<Integer, Boolean>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
mDanmakuContext = DanmakuContext.create();
mDanmakuContext
.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_NONE)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)//越大速度越慢
.setScaleTextSize(1.2f)
.setCacheStuffer(new BackgroundCacheStuffer(), mCacheStufferAdapter)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
}
示例4: handleOnDanmakuConfigChanged
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
protected boolean handleOnDanmakuConfigChanged(DanmakuContext 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) {
mContext.mDanmakuFilters.registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
} else {
mContext.mDanmakuFilters.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(mContext.isPreventOverlappingEnabled() || mContext.isMaxLinesLimited());
}
handled = true;
}
return handled;
}
示例5: DrawTask
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
public DrawTask(DanmakuTimer timer, DanmakuContext context,
TaskListener taskListener) {
if (context == null) {
throw new IllegalArgumentException("context is null");
}
mContext = context;
mDisp = context.getDisplayer();
mTaskListener = taskListener;
mRenderer = new DanmakuRenderer(context);
mRenderer.setVerifierEnabled(mContext.isPreventOverlappingEnabled() || mContext.isMaxLinesLimited());
initTimer(timer);
Boolean enable = mContext.isDuplicateMergingEnabled();
if (enable != null) {
if(enable) {
mContext.mDanmakuFilters.registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
} else {
mContext.mDanmakuFilters.unregisterFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
}
}
}
示例6: initDanmaku
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
private void initDanmaku() {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<Integer, Integer>();
// 滚动弹幕最大显示3行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<Integer, Boolean>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
mDanmakuContext = DanmakuContext.create();
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(1.2f)
.setCacheStuffer(new SpannedCacheStuffer(), null) // 图文混排使用SpannedCacheStuffer
// .setCacheStuffer(new BackgroundCacheStuffer()) // 绘制背景使用BackgroundCacheStuffer
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
}
示例7: initMediaPlayer
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
@SuppressLint("UseSparseArrays")
private void initMediaPlayer() {
//配置播放器
MediaController mMediaController = new MediaController(this);
mMediaController.setTitle(title);
mPlayerView.setMediaController(mMediaController);
mPlayerView.setMediaBufferingIndicator(mBufferingIndicator);
mPlayerView.requestFocus();
mPlayerView.setOnInfoListener(onInfoListener);
mPlayerView.setOnSeekCompleteListener(onSeekCompleteListener);
mPlayerView.setOnCompletionListener(onCompletionListener);
mPlayerView.setOnControllerEventsListener(onControllerEventsListener);
//设置弹幕开关监听
mMediaController.setDanmakuSwitchListener(this);
//设置返回键监听
mMediaController.setVideoBackEvent(this);
//配置弹幕库
mDanmakuView.enableDanmakuDrawingCache(true);
//设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
//滚动弹幕最大显示5行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
//设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
//设置弹幕样式
danmakuContext = DanmakuContext.create();
danmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(0.8f)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
loadData();
}
示例8: initMediaPlayer
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
private void initMediaPlayer() {
MediaController controller = new MediaController(this);
controller.setTitle(mTitle);
mPlayerView.setMediaController(controller);
mPlayerView.setMediaBufferingIndicator(mBufferingIndicator);
mPlayerView.requestFocus();
mPlayerView.setOnInfoListener(mOnInfoListener);
mPlayerView.setOnSeekCompleteListener(mOnSeekCompleteListener);
mPlayerView.setOnCompletionListener(mOnCompletionListener);
mPlayerView.setOnControlEventsListener(mOnControlEventsListener);
// 设置弹幕开关监听
controller.setDanmakuSwitchListener(this);
// 设置返回键监听
controller.setVideoBackListener(this);
// 配置弹幕库
mDanmakuView.enableDanmakuDrawingCache(true);
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
// 滚动屏幕最大显示五行
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5);
// 设置是否禁止重叠
HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
// 设置弹幕样式
mDanmakuContext = DanmakuContext.create();
mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)
.setScaleTextSize(0.8f)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
loadData();
}
示例9: getDanmakuContext
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
public DanmakuContext getDanmakuContext(boolean isHalfScreen) {
if (isHalfScreen) {
if (this.mHalfScreenEngine != null) {
return ((DanmakuDanmakuEngine) this.mHalfScreenEngine).getDanmakuContext();
}
} else if (this.mFullScreenEngine != null) {
return ((DanmakuDanmakuEngine) this.mFullScreenEngine).getDanmakuContext();
}
return null;
}
示例10: DrawTask
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
public DrawTask(DanmakuTimer timer, DanmakuContext context, TaskListener taskListener) {
boolean z = false;
if (context == null) {
throw new IllegalArgumentException("context is null");
}
this.mContext = context;
this.mDisp = context.getDisplayer();
this.mTaskListener = taskListener;
this.mRenderer = new DanmakuRenderer(context);
this.mRenderer.setOnDanmakuShownListener(new OnDanmakuShownListener() {
public void onDanmakuShown(BaseDanmaku danmaku) {
if (DrawTask.this.mTaskListener != null) {
DrawTask.this.mTaskListener.onDanmakuShown(danmaku);
}
}
});
IRenderer iRenderer = this.mRenderer;
if (this.mContext.isPreventOverlappingEnabled() || this.mContext.isMaxLinesLimited()) {
z = true;
}
iRenderer.setVerifierEnabled(z);
initTimer(timer);
Boolean enable = Boolean.valueOf(this.mContext.isDuplicateMergingEnabled());
if (enable == null) {
return;
}
if (enable.booleanValue()) {
this.mContext.mDanmakuFilters.registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
} else {
this.mContext.mDanmakuFilters.unregisterFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
}
}
示例11: onDanmakuConfigChanged
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
public boolean onDanmakuConfigChanged(DanmakuContext config, DanmakuConfigTag tag, Object... values) {
boolean handled = handleOnDanmakuConfigChanged(config, tag, values);
if (this.mTaskListener != null) {
this.mTaskListener.onDanmakuConfigChanged();
}
return handled;
}
示例12: handleOnDanmakuConfigChanged
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
protected boolean handleOnDanmakuConfigChanged(DanmakuContext config, DanmakuConfigTag tag, Object[] values) {
boolean z = false;
if (tag == null || DanmakuConfigTag.MAXIMUM_NUMS_IN_SCREEN.equals(tag)) {
return true;
}
if (DanmakuConfigTag.DUPLICATE_MERGING_ENABLED.equals(tag)) {
Boolean enable = values[0];
if (enable == null) {
return false;
}
if (enable.booleanValue()) {
this.mContext.mDanmakuFilters.registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
} else {
this.mContext.mDanmakuFilters.unregisterFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
}
return true;
} else if (DanmakuConfigTag.SCALE_TEXTSIZE.equals(tag) || DanmakuConfigTag.SCROLL_SPEED_FACTOR.equals(tag)) {
requestClearRetainer();
return false;
} else if (!DanmakuConfigTag.MAXIMUN_LINES.equals(tag) && !DanmakuConfigTag.OVERLAPPING_ENABLE.equals(tag)) {
return false;
} else {
if (this.mRenderer != null) {
IRenderer iRenderer = this.mRenderer;
if (this.mContext.isPreventOverlappingEnabled() || this.mContext.isMaxLinesLimited()) {
z = true;
}
iRenderer.setVerifierEnabled(z);
}
return true;
}
}
示例13: filter
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
public boolean filter(BaseDanmaku danmaku, int index, int totalsizeInScreen, DanmakuTimer timer, boolean fromCachingTask, DanmakuContext config) {
boolean filtered = needFilter(danmaku, index, totalsizeInScreen, timer, fromCachingTask);
if (filtered) {
danmaku.mFilterParam |= 128;
}
return filtered;
}
示例14: filterSecondary
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
public boolean filterSecondary(BaseDanmaku danmaku, int lines, int totalsizeInScreen, DanmakuTimer timer, boolean willHit, DanmakuContext context) {
for (IDanmakuFilter<?> f : this.mFilterArraySecondary) {
if (f != null) {
boolean filtered = f.filter(danmaku, lines, totalsizeInScreen, timer, willHit, context);
danmaku.filterResetFlag = context.mGlobalFlagValues.FILTER_RESET_FLAG;
if (filtered) {
return true;
}
}
}
return false;
}
示例15: CacheManagingDrawTask
import master.flame.danmaku.danmaku.model.android.DanmakuContext; //导入依赖的package包/类
public CacheManagingDrawTask(DanmakuTimer timer, DanmakuContext config, TaskListener taskListener, int maxCacheSize) {
super(timer, config, taskListener);
NativeBitmapFactory.loadLibs();
this.mMaxCacheSize = maxCacheSize;
if (NativeBitmapFactory.isInNativeAlloc()) {
this.mMaxCacheSize = maxCacheSize * 2;
}
this.mCacheManager = new CacheManager(maxCacheSize, 3);
this.mRenderer.setCacheManager(this.mCacheManager);
}