Java Code Examples for master.flame.danmaku.danmaku.model.IDanmakus#isEmpty()

The following examples show how to use master.flame.danmaku.danmaku.model.IDanmakus#isEmpty() . 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: DanmakuTouchHelper.java    From letv with Apache License 2.0 6 votes vote down vote up
public boolean onTouchEvent(MotionEvent event) {
    switch (event.getAction()) {
        case 1:
            IDanmakus clickDanmakus = touchHitDanmaku(event.getX(), event.getY());
            BaseDanmaku newestDanmaku = null;
            if (!(clickDanmakus == null || clickDanmakus.isEmpty())) {
                performClick(clickDanmakus);
                newestDanmaku = fetchLatestOne(clickDanmakus);
            }
            if (newestDanmaku != null) {
                performClickWithlatest(newestDanmaku);
                break;
            }
            break;
    }
    return false;
}
 
Example 2
Source File: DanmakuTouchHelper.java    From letv with Apache License 2.0 6 votes vote down vote up
public IDanmakus touchHitDanmaku(float x, float y) {
    IDanmakus hitDanmakus = new Danmakus();
    this.mDanmakuBounds.setEmpty();
    IDanmakus danmakus = this.danmakuView.getCurrentVisibleDanmakus();
    if (danmakus != null && !danmakus.isEmpty()) {
        IDanmakuIterator iterator = danmakus.iterator();
        while (iterator.hasNext()) {
            BaseDanmaku danmaku = iterator.next();
            if (danmaku != null) {
                this.mDanmakuBounds.set(danmaku.getLeft(), danmaku.getTop() - 30.0f, danmaku.getRight(), danmaku.getBottom() + 30.0f);
                if (this.mDanmakuBounds.contains(x, y)) {
                    danmaku.clickX = x;
                    danmaku.clickY = y;
                    danmaku.setRectF(this.mDanmakuBounds);
                    hitDanmakus.addItem(danmaku);
                    break;
                }
            }
        }
    }
    return hitDanmakus;
}
 
Example 3
Source File: DrawTask.java    From letv with Apache License 2.0 5 votes vote down vote up
public IDanmakus getVisibleDanmakusOnTime(long time) {
    IDanmakus subDanmakus = this.danmakuList.subnew((time - this.mContext.mDanmakuFactory.MAX_DANMAKU_DURATION) - 100, time + this.mContext.mDanmakuFactory.MAX_DANMAKU_DURATION);
    IDanmakus visibleDanmakus = new Danmakus();
    if (!(subDanmakus == null || subDanmakus.isEmpty())) {
        IDanmakuIterator iterator = subDanmakus.iterator();
        while (iterator.hasNext()) {
            BaseDanmaku danmaku = iterator.next();
            if (danmaku.isShown() && !danmaku.isOutside()) {
                visibleDanmakus.addItem(danmaku);
            }
        }
    }
    return visibleDanmakus;
}
 
Example 4
Source File: DanmakuTouchHelper.java    From letv with Apache License 2.0 4 votes vote down vote up
private BaseDanmaku fetchLatestOne(IDanmakus danmakus) {
    if (danmakus.isEmpty()) {
        return null;
    }
    return danmakus.last();
}
 
Example 5
Source File: DanmakuView.java    From letv with Apache License 2.0 4 votes vote down vote up
public boolean isClickDanmukuRange(MotionEvent event) {
    IDanmakus clickDanmakus = this.mTouchHelper.touchHitDanmaku(event.getX(), event.getY());
    return (clickDanmakus == null || clickDanmakus.isEmpty()) ? false : true;
}