本文整理汇总了Java中master.flame.danmaku.controller.DrawHandler类的典型用法代码示例。如果您正苦于以下问题:Java DrawHandler类的具体用法?Java DrawHandler怎么用?Java DrawHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DrawHandler类属于master.flame.danmaku.controller包,在下文中一共展示了DrawHandler类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCallback
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
public void setCallback(DrawHandler.Callback callback) {
this.mCallback = callback;
if (this.handler != null) {
this.handler.setCallback(callback);
}
}
示例2: stopDraw
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
private void stopDraw() {
DrawHandler handler = this.handler;
this.handler = null;
unlockCanvasAndPost();
if (handler != null) {
handler.quit();
}
if (this.mHandlerThread != null) {
HandlerThread handlerThread = this.mHandlerThread;
this.mHandlerThread = null;
try {
handlerThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
handlerThread.quit();
}
}
示例3: stopDraw
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
private void stopDraw() {
DrawHandler handler = this.handler;
this.handler = null;
unlockCanvasAndPost();
if (handler != null) {
handler.quit();
}
if (mHandlerThread != null) {
HandlerThread handlerThread = this.mHandlerThread;
mHandlerThread = null;
try {
handlerThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
handlerThread.quit();
}
}
示例4: initDanmaku
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
protected void initDanmaku(DanmakuSurfaceView danmakuSurfaceView, BaseDanmakuParser parser) {
if (danmakuSurfaceView != null) {
//parser = createParser(null);
danmakuSurfaceView.setCallback(new DrawHandler.Callback() {
@Override public void updateTimer(DanmakuTimer timer) {
}
@Override public void prepared() {
danmakuSurfaceView.start();
}
});
danmakuSurfaceView.prepare(parser);
//danmakuSurfaceView.showFPS(true);
danmakuSurfaceView.enableDanmakuDrawingCache(true);
danmakuSurfaceView.setZOrderOnTop(true);
danmakuSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
}
}
示例5: initListener
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
@Override
protected void initListener() {
mDanmakuView.setCallback(new DrawHandler.Callback() {
@Override
public void prepared() {
mDanmakuView.start();
}
@Override
public void updateTimer(DanmakuTimer timer) {
}
@Override
public void danmakuShown(BaseDanmaku danmaku) {
}
@Override
public void drawingFinished() {
}
});
mRetryGetDanmuBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mRoomPresenter.getChatListInfo(roomId);
}
});
}
示例6: start
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
@Override
public void start(long postion) {
if (handler == null) {
prepare();
}else{
handler.removeCallbacksAndMessages(null);
}
handler.obtainMessage(DrawHandler.START, postion).sendToTarget();
}
示例7: start
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
@Override
public void start(long postion) {
if (handler == null) {
prepare();
} else {
handler.removeCallbacksAndMessages(null);
}
handler.obtainMessage(DrawHandler.START, postion).sendToTarget();
}
示例8: initDanmuView
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
private void initDanmuView() {
if (mDanmakuView != null) {
mDanmakuView.setCallback(new DrawHandler.Callback() {
@Override
public void prepared() {
mDanmakuView.start();
}
@Override
public void updateTimer(DanmakuTimer timer) {
}
@Override
public void danmakuShown(BaseDanmaku danmaku) {
}
@Override
public void drawingFinished() {
}
});
}
mDanmakuView.prepare(new BaseDanmakuParser() {
@Override
protected Danmakus parse() {
return new Danmakus();
}
}, mDanmakuContext);
mDanmakuView.enableDanmakuDrawingCache(true);
}
示例9: danmuku
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
private void danmuku(InputStream inputStream) {
if (mDanmakuView != null) {
mParser = DanmakuHelper.createParser(inputStream);
mDanmakuView.setCallback(new DrawHandler.Callback() {
@Override
public void updateTimer(DanmakuTimer timer) {
}
@Override
public void danmakuShown(BaseDanmaku danmaku) {
}
@Override
public void drawingFinished() {
}
@Override
public void prepared() {
mIsDanmakuReday = true;
}
});
mDanmakuView.setOnDanmakuClickListener(new IDanmakuView.OnDanmakuClickListener() {
@Override
public void onDanmakuClick(BaseDanmaku latest) {
// Log.d("DFM", "onDanmakuClick text:" + latest.text);
}
@Override
public void onDanmakuClick(IDanmakus danmakus) {
// Log.d("DFM", "onDanmakuClick danmakus size:" + danmakus.size());
}
});
mDanmakuView.prepare(mParser, mDanmakuContext);
mDanmakuView.enableDanmakuDrawingCache(true);
// mDanmakuView.showFPS(true);
}
}
示例10: loadData
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
/**
* 获取视频数据以及解析弹幕
*/
@Override
public void loadData() {
RetrofitHelper.getBiliGoAPI()
.getHDVideoUrl(cid, 4, ConstantUtil.VIDEO_TYPE_MP4)
.compose(bindToLifecycle())
.map(videoInfo -> Uri.parse(videoInfo.getDurl().get(0).getUrl()))
.observeOn(AndroidSchedulers.mainThread())
.flatMap(new Func1<Uri, Observable<BaseDanmakuParser>>() {
@Override
public Observable<BaseDanmakuParser> call(Uri uri) {
mPlayerView.setVideoURI(uri);
mPlayerView.setOnPreparedListener(mp -> {
mLoadingAnim.stop();
startText = startText + "【完成】\n视频缓冲中...";
mPrepareText.setText(startText);
mVideoPrepareLayout.setVisibility(View.GONE);
});
String url = "http://comment.bilibili.com/" + cid + ".xml";
return BiliDanmukuDownloadUtil.downloadXML(url);
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(baseDanmakuParser -> {
mDanmakuView.prepare(baseDanmakuParser, danmakuContext);
mDanmakuView.showFPS(false);
mDanmakuView.enableDanmakuDrawingCache(false);
mDanmakuView.setCallback(new DrawHandler.Callback() {
@Override
public void prepared() {
mDanmakuView.start();
}
@Override
public void updateTimer(DanmakuTimer danmakuTimer) {
}
@Override
public void danmakuShown(BaseDanmaku danmaku) {
}
@Override
public void drawingFinished() {
}
});
mPlayerView.start();
}, throwable -> {
startText = startText + "【失败】\n视频缓冲中...";
mPrepareText.setText(startText);
startText = startText + "【失败】\n" + throwable.getMessage();
mPrepareText.setText(startText);
});
}
示例11: loadData
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
@Override
public void loadData() {
RetrofitHelper.getBiliGoAPI()
.getHDVideoUrl(mCid, 4, ConstantUtil.VIDEO_TYPE_MP4)
.compose(bindToLifecycle())
.map(videoInfo -> Uri.parse(videoInfo.getDurl().get(0).getUrl()))
.observeOn(AndroidSchedulers.mainThread())
.flatMap(new Func1<Uri, Observable<BaseDanmakuParser>>() {
@Override
public Observable<BaseDanmakuParser> call(Uri uri) {
mPlayerView.setVideoURI(uri);
mPlayerView.setOnClickListener(v -> {
mLoadingAnim.stop();
mStartText += "【完成】\n视频缓冲中...";
mPrepareText.setText(mStartText);
mVideoPrepareLayout.setVisibility(View.GONE);
});
String url = "http://comment.bilibili.com/" + mCid + ".xml";
return BiliDanmukuDownloadUtil.downloadXML(url);
}
})
.subscribeOn(Schedulers.io())
.subscribe(baseDanmakuParser -> {
mDanmakuView.prepare(baseDanmakuParser, mDanmakuContext);
mDanmakuView.showFPS(false);
mDanmakuView.enableDanmakuDrawingCache(false);
mDanmakuView.setCallback(new DrawHandler.Callback() {
@Override
public void prepared() {
mDanmakuView.start();
}
@Override
public void updateTimer(DanmakuTimer timer) {
}
@Override
public void danmakuShown(BaseDanmaku danmaku) {
}
@Override
public void drawingFinished() {
}
});
mPlayerView.start();
}, throwable -> {
mStartText += "【失败】\n视频缓冲中...";
mPrepareText.setText(mStartText);
mStartText += "【失败】\n" + throwable.getMessage();
mPrepareText.setText(mStartText);
});
}
示例12: prepare
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
private void prepare() {
if (this.handler == null) {
this.handler = new DrawHandler(getLooper(this.mDrawingThreadType), this, this.mDanmakuVisible);
}
}
示例13: DanmakuManager
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
public DanmakuManager(IDanmakuView iDanmakuView) {
mIDanmakuView = iDanmakuView;
mActivity = (Activity) mIDanmakuView.getView().getContext();
mActivity.getApplication().registerComponentCallbacks(this);
mActivity.getApplication().registerActivityLifecycleCallbacks(this);
mDanmakuTextSize = mActivity.getResources().getDimensionPixelSize(R.dimen.danmaku_text_size);
float shadowRadius = mActivity.getResources().getDimensionPixelSize(R.dimen.danmaku_shadow_radius);
mIDanmakuView.setCallback(new DrawHandler.Callback() {
@Override
public void prepared() {
mIDanmakuView.start();
handleConfiguration(mActivity.getResources().getConfiguration());
}
@Override
public void updateTimer(DanmakuTimer timer) {
}
@Override
public void danmakuShown(BaseDanmaku danmaku) {
}
@Override
public void drawingFinished() {
}
});
ArrayMap<Integer, Integer> maxLinesPair = new ArrayMap<>();
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 4);
ArrayMap<Integer, Boolean> overlappingEnablePair = new ArrayMap<>();
overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
mIDanmakuView.prepare(new BaseDanmakuParser() {
@Override
protected IDanmakus parse() {
return new Danmakus();
}
},
DanmakuContext.create()
.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_SHADOW, shadowRadius)
.setScrollSpeedFactor(1.5f)
.setDuplicateMergingEnabled(false)
.setMaximumVisibleSizeInScreen(-1)
.setCacheStuffer(new BackgroundCacheStuffer(), null)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair));
}
示例14: initDanmuConfig
import master.flame.danmaku.controller.DrawHandler; //导入依赖的package包/类
private void initDanmuConfig() {
// 设置最大显示行数
HashMap<Integer, Integer> maxLinesPair = new HashMap<>();
maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 4); // 滚动弹幕最大显示4行
// 设置是否禁止重叠
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_NONE)
.setDuplicateMergingEnabled(false)
.setScrollSpeedFactor(1.2f)//越大速度越慢
.setScaleTextSize(1.2f)
.setMaximumLines(maxLinesPair)
.preventOverlapping(overlappingEnablePair);
setCallback(new DrawHandler.Callback() {
@Override
public void prepared() {
start();
}
@Override
public void updateTimer(DanmakuTimer timer) {
}
@Override
public void danmakuShown(BaseDanmaku danmaku) {
}
@Override
public void drawingFinished() {
}
});
prepare(new BaseDanmakuParser() {
@Override
protected IDanmakus parse() {
return new Danmakus();
}
}, mDanmakuContext);
enableDanmakuDrawingCache(true);
}