本文整理汇总了Java中master.flame.danmaku.danmaku.util.DanmakuUtils类的典型用法代码示例。如果您正苦于以下问题:Java DanmakuUtils类的具体用法?Java DanmakuUtils怎么用?Java DanmakuUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DanmakuUtils类属于master.flame.danmaku.danmaku.util包,在下文中一共展示了DanmakuUtils类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCache
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
public boolean createCache(BaseDanmaku item) {
if (!item.isMeasured()) {
item.measure(CacheManagingDrawTask.this.mDisp, true);
}
DrawingCache cache = null;
try {
cache = DanmakuUtils.buildDanmakuDrawingCache(item, CacheManagingDrawTask.this.mDisp, (DrawingCache) CacheManager.this.mCachePool.acquire());
item.cache = cache;
return true;
} catch (OutOfMemoryError e) {
if (cache != null) {
CacheManager.this.mCachePool.release(cache);
}
item.cache = null;
return false;
} catch (Exception e2) {
if (cache != null) {
CacheManager.this.mCachePool.release(cache);
}
item.cache = null;
return false;
}
}
开发者ID:JackChan1999,项目名称:letv,代码行数:24,代码来源:CacheManagingDrawTask.java
示例2: _doParse
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
/**
* @param jsonStr 弹幕数据
* @return 转换后的Danmakus
*/
private Danmakus _doParse(String jsonStr) {
Logger.w(jsonStr);
Danmakus danmakus = new Danmakus();
if (TextUtils.isEmpty(jsonStr)) {
return danmakus;
}
try {
// 由于 DanmakuInfo 和父类用了相同的字段,用 Gson 直接解析会报错,这里用 FastJson 来处理
// List<DanmakuInfo> datas = GsonHelper.convertEntities(jsonStr, DanmakuInfo.class);
List<DanmakuInfo> datas = JSON.parseArray(jsonStr, DanmakuInfo.class);
Logger.i(datas.toString());
int size = datas.size();
for (int i = 0; i < size; i++) {
BaseDanmaku item = mContext.mDanmakuFactory.createDanmaku(datas.get(i).getType(), mContext);
if (item != null) {
item.setTime(datas.get(i).getTime());
item.textSize = datas.get(i).getTextSize();
item.textColor = datas.get(i).getTextColor();
item.textShadowColor = textColor <= Color.BLACK ? Color.WHITE : Color.BLACK;
DanmakuUtils.fillText(item, datas.get(i).getContent());
item.index = i;
item.setTimer(mTimer);
danmakus.addItem(item);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return danmakus;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:DanmakuParser.java
示例3: compare
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
@Override
public int compare(BaseDanmaku obj1, BaseDanmaku obj2) {
if (mDuplicateMergingEnable && DanmakuUtils.isDuplicate(obj1, obj2)) {
return 0;
}
return DanmakuUtils.compare(obj1, obj2);
}
开发者ID:lisnstatic,项目名称:live_master,代码行数:8,代码来源:Danmakus.java
示例4: compare
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
@Override
public int compare(BaseDanmaku obj1, BaseDanmaku obj2) {
int result = Float.compare(obj1.getTop(), obj2.getTop());
if (result != 0) {
return result;
}
return DanmakuUtils.compare(obj1, obj2);
}
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:9,代码来源:Danmakus.java
示例5: fix
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
public void fix(BaseDanmaku drawItem, IDisplayer disp, Verifier verifier) {
if (!drawItem.isOutside()) {
boolean shown = drawItem.isShown();
float topPos = drawItem.getTop();
int lines = 0;
boolean willHit = (drawItem.isShown() || this.mVisibleDanmakus.isEmpty()) ? false : true;
boolean isOutOfVerticalEdge = false;
if (topPos < 0.0f) {
topPos = ((float) disp.getHeight()) - drawItem.paintHeight;
}
BaseDanmaku removeItem = null;
BaseDanmaku firstItem = null;
if (!shown) {
this.mCancelFixingFlag = false;
IDanmakuIterator it = this.mVisibleDanmakus.iterator();
while (!this.mCancelFixingFlag && it.hasNext()) {
lines++;
BaseDanmaku item = it.next();
if (item == drawItem) {
removeItem = null;
willHit = false;
break;
}
if (firstItem == null) {
firstItem = item;
if (firstItem.getBottom() != ((float) disp.getHeight())) {
break;
}
}
if (topPos < 0.0f) {
removeItem = null;
break;
}
willHit = DanmakuUtils.willHitInDuration(disp, item, drawItem, drawItem.getDuration(), drawItem.getTimer().currMillisecond);
if (!willHit) {
removeItem = item;
break;
}
topPos = item.getTop() - drawItem.paintHeight;
}
isOutOfVerticalEdge = isOutVerticalEdge(false, drawItem, disp, topPos, firstItem, null);
if (isOutOfVerticalEdge) {
topPos = ((float) disp.getHeight()) - drawItem.paintHeight;
willHit = true;
} else if (topPos >= 0.0f) {
willHit = false;
}
}
if (verifier == null || !verifier.skipLayout(drawItem, topPos, lines, willHit)) {
if (isOutOfVerticalEdge) {
clear();
}
drawItem.layout(disp, drawItem.getLeft(), topPos);
if (!shown) {
this.mVisibleDanmakus.removeItem(removeItem);
this.mVisibleDanmakus.addItem(drawItem);
}
}
}
}
开发者ID:JackChan1999,项目名称:letv,代码行数:61,代码来源:DanmakusRetainer.java
示例6: compare
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
public int compare(BaseDanmaku obj1, BaseDanmaku obj2) {
if (this.mDuplicateMergingEnable && DanmakuUtils.isDuplicate(obj1, obj2)) {
return 0;
}
return DanmakuUtils.compare(obj1, obj2);
}
开发者ID:JackChan1999,项目名称:letv,代码行数:7,代码来源:Danmakus.java
示例7: Danmaku
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
public Danmaku(CharSequence text) {
DanmakuUtils.fillText(this, text);
}
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:Danmaku.java
示例8: fix
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
@Override
public void fix(BaseDanmaku drawItem, IDisplayer disp, Verifier verifier) {
if (drawItem.isOutside())
return;
boolean shown = drawItem.isShown();
float topPos = drawItem.getTop();
int lines = 0;
boolean willHit = !drawItem.isShown() && !mVisibleDanmakus.isEmpty();
boolean isOutOfVerticalEdge = false;
if (topPos < 0) {
topPos = disp.getHeight() - drawItem.paintHeight;
}
BaseDanmaku removeItem = null, firstItem = null;
if (!shown) {
mCancelFixingFlag = false;
IDanmakuIterator it = mVisibleDanmakus.iterator();
while (!mCancelFixingFlag && it.hasNext()) {
lines++;
BaseDanmaku item = it.next();
if (item == drawItem) {
removeItem = null;
willHit = false;
break;
}
if (firstItem == null) {
firstItem = item;
if (firstItem.getBottom() != disp.getHeight()) {
break;
}
}
if (topPos < 0) {
removeItem = null;
break;
}
// 检查碰撞
willHit = DanmakuUtils.willHitInDuration(disp, item, drawItem,
drawItem.getDuration(), drawItem.getTimer().currMillisecond);
if (!willHit) {
removeItem = item;
// topPos = item.getBottom() - drawItem.paintHeight;
break;
}
topPos = item.getTop() - drawItem.paintHeight;
}
isOutOfVerticalEdge = isOutVerticalEdge(false, drawItem, disp, topPos, firstItem, null);
if (isOutOfVerticalEdge) {
topPos = disp.getHeight() - drawItem.paintHeight;
willHit = true;
} else if (topPos >= 0) {
willHit = false;
}
}
if (verifier != null && verifier.skipLayout(drawItem, topPos, lines, willHit)) {
return;
}
if (isOutOfVerticalEdge) {
clear();
}
drawItem.layout(disp, drawItem.getLeft(), topPos);
if (!shown) {
mVisibleDanmakus.removeItem(removeItem);
mVisibleDanmakus.addItem(drawItem);
}
}
开发者ID:dingdingyr,项目名称:DanmakuFlameMaster-,代码行数:77,代码来源:DanmakusRetainer.java
示例9: Danmaku
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
public Danmaku(String text) {
DanmakuUtils.fillText(this, text);
}
开发者ID:liucloo,项目名称:ijkPlayer-Danmaku,代码行数:4,代码来源:Danmaku.java
示例10: fix
import master.flame.danmaku.danmaku.util.DanmakuUtils; //导入依赖的package包/类
@Override
public void fix(BaseDanmaku drawItem, IDisplayer disp) {
if (drawItem.isOutside())
return;
boolean shown = drawItem.isShown();
float topPos = drawItem.getTop();
if (topPos < 0) {
topPos = disp.getHeight() - drawItem.paintHeight;
}
BaseDanmaku removeItem = null, firstItem = null;
if (!shown) {
IDanmakuIterator it = mVisibleDanmakus.iterator();
while (it.hasNext()) {
BaseDanmaku item = it.next();
if (item == drawItem) {
removeItem = null;
break;
}
if (firstItem == null) {
firstItem = item;
if (firstItem.getBottom() != disp.getHeight()) {
break;
}
}
if (topPos < 0) {
removeItem = null;
break;
}
// 检查碰撞
boolean willHit = DanmakuUtils.willHitInDuration(disp, item, drawItem,
drawItem.getDuration(), drawItem.getTimer().currMillisecond);
if (!willHit) {
removeItem = item;
// topPos = item.getBottom() - drawItem.paintHeight;
break;
}
topPos = item.getTop() - drawItem.paintHeight;
}
topPos = checkVerticalEdge(false, drawItem, disp, topPos, firstItem, null);
}
drawItem.layout(disp, drawItem.getLeft(), topPos);
if (!shown) {
mVisibleDanmakus.removeItem(removeItem);
mVisibleDanmakus.addItem(drawItem);
}
}
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:58,代码来源:DanmakusRetainer.java
注:本文中的master.flame.danmaku.danmaku.util.DanmakuUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论