master.flame.danmaku.controller.DrawHandler Java Examples

The following examples show how to use master.flame.danmaku.controller.DrawHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DanmakuView.java    From letv with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #2
Source File: VideoPlayActivity.java    From BlueBoard with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
 
Example #3
Source File: DanmakuSurfaceView.java    From BlueBoard with Apache License 2.0 5 votes vote down vote up
@Override
public void start(long postion) {
    if (handler == null) {
        prepare();
    } else {
        handler.removeCallbacksAndMessages(null);
    }
    handler.obtainMessage(DrawHandler.START, postion).sendToTarget();
}
 
Example #4
Source File: GameBaseActivity.java    From kcanotify_h5-master with GNU General Public License v3.0 4 votes vote down vote up
/**
 * danmuku init
 */
public void initDanMuKu(){
    //弹幕
    // 设置最大显示行数
    HashMap<Integer, Integer> maxLinesPair = new HashMap<Integer, Integer>();
    maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 10); // 滚动弹幕最大显示10行
    // 设置是否禁止重叠
    HashMap<Integer, Boolean> overlappingEnablePair = new HashMap<Integer, Boolean>();
    overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
    overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);

    danmakuContext = DanmakuContext.create();
    danmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 5).setDuplicateMergingEnabled(false)
            .setMaximumLines(maxLinesPair)
            .preventOverlapping(overlappingEnablePair).setDanmakuMargin(20);
    danmakuView = findViewById(R.id.danmaku_view);
    danmakuView.enableDanmakuDrawingCache(true);
    danmakuView.setCallback(new DrawHandler.Callback() {
        @Override
        public void prepared() {
            showDanmaku = true;
            danmakuView.start();
        }

        @Override
        public void updateTimer(DanmakuTimer timer) {

        }

        @Override
        public void danmakuShown(BaseDanmaku danmaku) {

        }

        @Override
        public void drawingFinished() {

        }
    });
    danmakuView.prepare(parser, danmakuContext);
}
 
Example #5
Source File: DanmakuSurfaceView.java    From letv with Apache License 2.0 4 votes vote down vote up
public void setCallback(DrawHandler.Callback callback) {
    this.mCallback = callback;
    if (this.handler != null) {
        this.handler.setCallback(callback);
    }
}
 
Example #6
Source File: DanmakuSurfaceView.java    From letv with Apache License 2.0 4 votes vote down vote up
private void prepare() {
    if (this.handler == null) {
        this.handler = new DrawHandler(getLooper(this.mDrawingThreadType), this, this.mDanmakuVisible);
    }
}
 
Example #7
Source File: DanmakuView.java    From letv with Apache License 2.0 4 votes vote down vote up
private void prepare() {
    if (this.handler == null) {
        this.handler = new DrawHandler(getLooper(this.mDrawingThreadType), this, this.mDanmakuVisible);
    }
}
 
Example #8
Source File: DanmakuTextureView.java    From letv with Apache License 2.0 4 votes vote down vote up
private void prepare() {
    if (this.handler == null) {
        this.handler = new DrawHandler(getLooper(this.mDrawingThreadType), this, this.mDanmakuVisible);
    }
}