コード例 #1
0
 public long getFirstCacheTime() {
   if (mCaches != null && mCaches.size() > 0) {
     BaseDanmaku firstItem = mCaches.first();
     if (firstItem == null) return 0;
     return firstItem.time;
   }
   return 0;
 }
コード例 #2
0
 private boolean push(BaseDanmaku item, int itemSize, boolean forcePush) {
   int size = itemSize; // sizeOf(item);
   while (mRealSize + size > mMaxSize && mCaches.size() > 0) {
     BaseDanmaku oldValue = mCaches.first();
     if (oldValue.isTimeOut()) {
       entryRemoved(false, oldValue, item);
       mCaches.removeItem(oldValue);
     } else {
       if (forcePush) {
         break;
       }
       return false;
     }
   }
   this.mCaches.addItem(item);
   mRealSize += size;
   // Log.e("CACHE", "realsize:"+mRealSize + ",size" + size);
   return true;
 }