From 7f5a370ed4bc5be1faafb52090829c49155b1481 Mon Sep 17 00:00:00 2001 From: calmer Date: Mon, 11 Nov 2013 10:22:46 +0800 Subject: [PATCH] Add prepare(Parser) method to DanmakuSurfaceView --- .../flame/danmaku/ui/widget/DanmakuSurfaceView.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuSurfaceView.java b/DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuSurfaceView.java index 3a2b5a50..a0938d6d 100644 --- a/DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuSurfaceView.java +++ b/DanmakuFlameMaster/src/main/java/master/flame/danmaku/ui/widget/DanmakuSurfaceView.java @@ -34,6 +34,7 @@ import master.flame.danmaku.controller.DrawTask; import master.flame.danmaku.controller.IDrawTask; import master.flame.danmaku.danmaku.model.DanmakuTimer; +import master.flame.danmaku.danmaku.parser.BaseDanmakuParser; public class DanmakuSurfaceView extends SurfaceView implements SurfaceHolder.Callback, View.OnClickListener { @@ -59,6 +60,7 @@ public class DanmakuSurfaceView extends SurfaceView implements SurfaceHolder.Cal private boolean mEnableDanmakuDrwaingCache; private OnClickListener mOnClickListener; + private BaseDanmakuParser mParser; public DanmakuSurfaceView(Context context) { super(context); @@ -149,6 +151,11 @@ public void prepare() { } } + public void prepare(BaseDanmakuParser parser) { + mParser = parser; + prepare(); + } + void drawDanmakus() { if (!isSurfaceCreated) return; @@ -228,6 +235,7 @@ private IDrawTask createTask(boolean useDrwaingCache, DanmakuTimer timer, Contex IDrawTask task = useDrwaingCache ? new CacheManagingDrawTask(timer, context, width, height, taskListener, 1024 * 1024 * getMemoryClass(getContext()) / 3) : new DrawTask(timer, context, width, height, taskListener); + task.setParser(mParser); task.prepare(); return task; }