• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CLog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中in.srain.cube.util.CLog的典型用法代码示例。如果您正苦于以下问题:Java CLog类的具体用法?Java CLog怎么用?Java CLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CLog类属于in.srain.cube.util包,在下文中一共展示了CLog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: moveToItem

import in.srain.cube.util.CLog; //导入依赖的package包/类
public void moveToItem(int item) {
    if (DEBUG) {
        CLog.d(LOG_TAG, "moveToItem: %s", item);
    }
    if (mViewPager == null) {
        throw new IllegalStateException("ViewPager has not been bound.");
    }
    if (mSelectedTabIndex == item) {
        // return;
    }
    mSelectedTabIndex = item;

    // will lead to call moveToItem again, but will not hit here :)
    mViewPager.setCurrentItem(item);
    if (DEBUG) {
        CLog.d(LOG_TAG, "mViewPager.setCurrentItem: %s", item);
    }
    if (mListener != null) {
        mListener.onPageSelected(item);
    }
    updateTab(item);
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:23,代码来源:TabPageIndicator.java


示例2: onRequestSuccess

import in.srain.cube.util.CLog; //导入依赖的package包/类
@Override
public void onRequestSuccess(T data) {
    if (DEBUG) {
        CLog.d(LOG_TAG, "%s, onRequestSuccess", getCacheKey());
    }
    if (hasBeenCanceled()) {
        return;
    }
    if (null != mHandler) {
        mHandler.onRequestFinish(data);

        // cache data is not available or
        // cache is available and time duration not reach timeout or not always use the cache
        if (mCacheData == null || (!mHasTimeout && !mUseCacheAnyway)) {
            notifyRequestFinish(ResultType.USE_DATA_FROM_SERVER, data, false);
        } else {
            if (DEBUG) {
                CLog.d(LOG_TAG, "%s, will not notifyRequestFinish", getCacheKey());
            }
        }
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:23,代码来源:CacheAbleRequest.java


示例3: onRequestFail

import in.srain.cube.util.CLog; //导入依赖的package包/类
@Override
public void onRequestFail(FailData failData) {
    RequestManager.getInstance().getRequestProxy(this).onRequestFail(this, failData);
    if (DEBUG) {
        CLog.d(LOG_TAG, "%s, onRequestFail", getCacheKey());
    }
    if (hasBeenCanceled()) {
        return;
    }
    if (null != mHandler) {
        mHandler.onRequestFail(failData);
        if (mCacheData != null && !cacheIsDisabled() && !mUseCacheAnyway) {
            notifyRequestFinish(ResultType.USE_CACHE_ON_FAIL, mCacheData, true);
        }
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:17,代码来源:CacheAbleRequest.java


示例4: onCacheData

import in.srain.cube.util.CLog; //导入依赖的package包/类
@Override
public void onCacheData(CacheResultType cacheResultType, T data, boolean outOfDate) {
    if (DEBUG) {
        CLog.d(LOG_TAG, "%s, onQueryFinish, out of date: %s", getCacheKey(), outOfDate);
    }
    if (hasBeenCanceled()) {
        return;
    }
    mCacheData = data;
    mOutOfDate = outOfDate;
    if (mHandler != null) {
        mHandler.onCacheData(data, outOfDate);

        if (mUseCacheAnyway) {
            notifyRequestFinish(ResultType.USE_CACHE_ANYWAY, data, mOutOfDate);
        } else {
            if (!outOfDate) {
                notifyRequestFinish(ResultType.USE_CACHE_NOT_EXPIRED, data, false);
            }
        }
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:23,代码来源:CacheAbleRequest.java


示例5: doSyncRequest

import in.srain.cube.util.CLog; //导入依赖的package包/类
protected static <T> T doSyncRequest(IRequest<T> request) {
    T data = null;
    try {
        StringBuilder sb = new StringBuilder();
        RequestData requestData = request.getRequestData();
        if (DEBUG) {
            CLog.d(LOG_TAG, "%s", requestData);
        }
        BaseRequestSender requestSender = RequestSenderFactory.create(request);
        if (requestSender != null) {
            requestSender.send();
            requestSender.getResponse(sb);
            if (DEBUG) {
                CLog.d(LOG_TAG, "%s: %s", requestData, sb.toString());
            }
            data = request.onDataFromServer(sb.toString());
        }
    } catch (Exception e) {
        e.printStackTrace();
        request.setFailData(FailData.networkError(request));
    }
    return data;
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:24,代码来源:DefaultRequestProxy.java


示例6: clear

import in.srain.cube.util.CLog; //导入依赖的package包/类
public synchronized void clear() throws IOException {

        // abort edit
        for (CacheEntry cacheEntry : new ArrayList<CacheEntry>(mLruEntries.values())) {
            if (cacheEntry.isUnderEdit()) {
                cacheEntry.abortEdit();
            }
        }
        mLruEntries.clear();
        mSize = 0;

        // delete current directory then rebuild
        if (SimpleDiskLruCache.DEBUG) {
            CLog.d(SimpleDiskLruCache.LOG_TAG, "delete directory");
        }

        waitJobDone();

        // rebuild
        FileUtils.deleteDirectoryQuickly(mDirectory);
        rebuildJournal();
    }
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:23,代码来源:LruActionTracer.java


示例7: beginEdit

import in.srain.cube.util.CLog; //导入依赖的package包/类
public synchronized CacheEntry beginEdit(String key) throws IOException {
    checkNotClosed();
    validateKey(key);

    if (SimpleDiskLruCache.DEBUG) {
        CLog.d(SimpleDiskLruCache.LOG_TAG, "beginEdit: %s", key);
    }
    CacheEntry cacheEntry = mLruEntries.get(key);
    if (cacheEntry == null) {
        cacheEntry = new CacheEntry(mDiskCache, key);
        mNewCreateList.add(key);
        mLruEntries.put(key, cacheEntry);
    }
    mEditList.put(key, cacheEntry);

    addActionLog(ACTION_DIRTY, cacheEntry);
    return cacheEntry;
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:19,代码来源:LruActionTracer.java


示例8: waitJobDone

import in.srain.cube.util.CLog; //导入依赖的package包/类
private void waitJobDone() {
    if (SimpleDiskLruCache.DEBUG) {
        CLog.d(SimpleDiskLruCache.LOG_TAG, "waitJobDone");
    }

    // remove synchronized method , exclude this code block for dead lock digging
    synchronized (mLock) {
        if (mIsRunning) {
            while (!mActionQueue.isEmpty()) {
                try {
                    mLock.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    if (SimpleDiskLruCache.DEBUG) {
        CLog.d(SimpleDiskLruCache.LOG_TAG, "job is done");
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:22,代码来源:LruActionTracer.java


示例9: trimToSize

import in.srain.cube.util.CLog; //导入依赖的package包/类
/**
 * remove files from list, delete files
 */
private synchronized void trimToSize() {

    if (mSize > mCapacity) {
        if (SimpleDiskLruCache.DEBUG) {
            CLog.d(SimpleDiskLruCache.LOG_TAG, "should trim, current is: %s", mSize);
        }
    }
    while (mSize > mCapacity) {
        Map.Entry<String, CacheEntry> toEvict = mLruEntries.entrySet().iterator().next();
        String key = toEvict.getKey();
        CacheEntry cacheEntry = toEvict.getValue();
        mLruEntries.remove(key);

        mSize -= cacheEntry.getSize();
        addActionLog(ACTION_PENDING_DELETE, cacheEntry);
        if (SimpleDiskLruCache.DEBUG) {
            CLog.d(SimpleDiskLruCache.LOG_TAG, "pending remove: %s, size: %s, after remove total: %s", key, cacheEntry.getSize(), mSize);
        }
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:24,代码来源:LruActionTracer.java


示例10: delete

import in.srain.cube.util.CLog; //导入依赖的package包/类
public synchronized boolean delete(String key) throws IOException {
    if (SimpleDiskLruCache.DEBUG) {
        CLog.d(SimpleDiskLruCache.LOG_TAG, "delete: %s", key);
    }
    checkNotClosed();
    validateKey(key);
    CacheEntry cacheEntry = mLruEntries.get(key);
    if (cacheEntry == null) {
        return false;
    }

    // delete at once
    cacheEntry.delete();
    mSize -= cacheEntry.getSize();
    cacheEntry.setSize(0);
    mLruEntries.remove(key);

    addActionLog(ACTION_DELETE, cacheEntry);
    return true;
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:21,代码来源:LruActionTracer.java


示例11: setCacheData

import in.srain.cube.util.CLog; //导入依赖的package包/类
public void setCacheData(final String cacheKey, final String data) {
    if (TextUtils.isEmpty(cacheKey) || TextUtils.isEmpty(data)) {
        return;
    }
    if (DEBUG) {
        CLog.d(LOG_TAG, "key: %s, setCacheData", cacheKey);
    }
    SimpleExecutor.getInstance().execute(

            new Runnable() {
                @Override
                public void run() {
                    CacheMetaData cacheMetaData = CacheMetaData.createForNow(data);
                    putDataToMemoryCache(cacheKey, cacheMetaData);
                    mFileCache.write(cacheKey, cacheMetaData.getCacheData());
                    mFileCache.flushDiskCacheAsyncWithDelay(1000);
                }
            }
    );
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:21,代码来源:CacheManager.java


示例12: doInBackground

import in.srain.cube.util.CLog; //导入依赖的package包/类
@Override
public void doInBackground() {
    if (DEBUG) {
        CLog.d(LOG_TAG, "key: %s, doInBackground: mWorkType: %s", mCacheAble.getCacheKey(), mWorkType);
    }
    switch (mWorkType) {

        case DO_READ_FROM_FILE:
            doQueryFromCacheFileInBackground();
            setCurrentStatus(AFTER_READ_FROM_FILE);
            break;

        case DO_READ_FROM_ASSERT:
            doQueryFromAssertCacheFileInBackground();
            setCurrentStatus(AFTER_READ_FROM_ASSERT);
            break;

        case DO_CONVERT:
            doConvertDataInBackground();
            setCurrentStatus(AFTER_CONVERT);
            break;

        default:
            break;
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:27,代码来源:CacheManager.java


示例13: getDiskCache

import in.srain.cube.util.CLog; //导入依赖的package包/类
/**
 * If disk is not read, will prepare it first.
 *
 * @return
 */
public DiskCache getDiskCache() {
    if (!mDiskCacheReady) {
        if (DEBUG) {
            CLog.d(LOG_TAG, "%s, try to access disk cache, but it is not open, try to open it.", mDiskCache);
        }
        openDiskCacheAsync();
    }
    synchronized (mDiskCacheLock) {
        while (mDiskCacheStarting) {
            try {
                if (DEBUG) {
                    CLog.d(LOG_TAG, "%s, try to access, but disk cache is not ready, wait", mDiskCache);
                }
                mDiskCacheLock.wait();
            } catch (InterruptedException e) {
            }
        }
    }
    return mDiskCache;
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:26,代码来源:DiskCacheProvider.java


示例14: obtain

import in.srain.cube.util.CLog; //导入依赖的package包/类
public static ImageTask obtain() {
    if (!USE_POOL) {
        return null;
    }
    // pop top, make top.next as top
    synchronized (sPoolSync) {
        if (sTop != null) {
            ImageTask m = sTop;
            sTop = m.next;
            m.next = null;
            sPoolSize--;
            m.mHasRecycled = false;
            if (CubeDebug.DEBUG_IMAGE) {
                CLog.d(LOG_TAG, "%s, obtain reused, pool remain: %d", m, sPoolSize);
            }
            return m;
        }
    }
    return null;
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:21,代码来源:ImageTask.java


示例15: tryToRecycle

import in.srain.cube.util.CLog; //导入依赖的package包/类
public void tryToRecycle() {
    if (!USE_POOL) {
        return;
    }
    clearForRecycle();

    // mark top as the next of current, then push current as pop
    synchronized (sPoolSync) {
        if (sPoolSize < MAX_POOL_SIZE) {
            next = sTop;
            sTop = this;
            sPoolSize++;
            if (CubeDebug.DEBUG_IMAGE) {
                CLog.d(LOG_TAG, "%s is put to recycle poll, pool size: %d", this, sPoolSize);
            } else {
                if (CubeDebug.DEBUG_IMAGE) {
                    CLog.d(LOG_TAG, "%s is not recycled, the poll is full: %d", this, sPoolSize);
                }
            }
        }
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:23,代码来源:ImageTask.java


示例16: renewForRequest

import in.srain.cube.util.CLog; //导入依赖的package包/类
public ImageTask renewForRequest(ImageLoadRequest request) {
    if (CubeDebug.DEBUG_IMAGE) {
        int lastId = mId;
        mId = ++sId;
        CLog.d(LOG_TAG, "%s, renew: %s => %s", this, lastId, mId);
    } else {
        mId = ++sId;
    }
    mStr = null;
    if (ImagePerformanceStatistics.sample(mId)) {
        mImageTaskStatistics = new ImageTaskStatistics();
    }
    mOriginUrl = request.getUrl();
    mRequestSize.set(request.getRequestWidth(), request.getRequestHeight());
    mRequest = request;
    return this;
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:18,代码来源:ImageTask.java


示例17: draw

import in.srain.cube.util.CLog; //导入依赖的package包/类
@Override
public void draw(Canvas canvas) {
    CLog.d("test", "draw");
    float yHeight = getProgress() / (float) getMax() * mSize;
    float radius = mSize / 2f;
    float angle = (float) (Math.acos((radius - yHeight) / radius) * 180 / Math.PI);
    float startAngle = 90 + angle;
    float sweepAngle = 360 - angle * 2;
    mPaint.setColor(getUnfinishedColor());
    canvas.drawArc(rectF, startAngle, sweepAngle, false, mPaint);

    canvas.save();
    canvas.rotate(180, mSize / 2, mSize / 2);
    mPaint.setColor(getFinishedColor());
    canvas.drawArc(rectF, 270 - angle, angle * 2, false, mPaint);
    canvas.restore();

    String text = getDrawText();
    if (!TextUtils.isEmpty(text)) {
        float textHeight = mTextPaint.descent() + mTextPaint.ascent();
        canvas.drawText(text, (mSize - mTextPaint.measureText(text)) / 2.0f, (mSize - textHeight) / 2.0f, mTextPaint);
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:24,代码来源:CircleProgress.java


示例18: detachImageViewFromImageTask

import in.srain.cube.util.CLog; //导入依赖的package包/类
/**
 * Detach the ImageView from the ImageTask.
 *
 * @param imageTask
 * @param imageView
 */
public void detachImageViewFromImageTask(ImageTask imageTask, CubeImageView imageView) {
    imageTask.removeImageView(imageView);
    if (imageTask.isLoading()) {
        if (!imageTask.isPreLoad() && !imageTask.stillHasRelatedImageView()) {
            LoadImageTask task = mLoadWorkList.get(imageTask.getIdentityKey());
            if (task != null) {
                task.cancel();
            }
            if (DEBUG) {
                CLog.d(LOG_TAG, "%s previous work is cancelled.", imageTask);
            }
        }
    }
    if (!imageTask.stillHasRelatedImageView()) {
        imageTask.tryToRecycle();
    }
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:24,代码来源:ImageLoader.java


示例19: addImageTask

import in.srain.cube.util.CLog; //导入依赖的package包/类
/**
 * Add the ImageTask into loading list.
 *
 * @param imageTask
 * @param imageView
 */
public void addImageTask(ImageTask imageTask, CubeImageView imageView) {
    if (!mHasBeenAddedToComponentManager) {
        CLog.w(LOG_TAG, "ImageLoader has not been add to a Component Manager.", this);
    }
    LoadImageTask runningTask = mLoadWorkList.get(imageTask.getIdentityKey());
    if (runningTask != null) {
        if (imageView != null) {
            if (DEBUG) {
                CLog.d(LOG_TAG, MSG_ATTACK_TO_RUNNING_TASK, imageTask, runningTask.getImageTask());
            }
            runningTask.getImageTask().addImageView(imageView);
            runningTask.getImageTask().notifyLoading(mImageLoadHandler, imageView);
        }
        return;
    } else {
        imageTask.addImageView(imageView);
    }

    imageTask.onLoading(mImageLoadHandler);

    LoadImageTask loadImageTask = createLoadImageTask(imageTask);
    mLoadWorkList.put(imageTask.getIdentityKey(), loadImageTask);
    mImageTaskExecutor.execute(loadImageTask);
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:31,代码来源:ImageLoader.java


示例20: queryCache

import in.srain.cube.util.CLog; //导入依赖的package包/类
/**
 * Check weather this imageTask has cache Drawable data.
 */
public boolean queryCache(ImageTask imageTask, CubeImageView imageView) {
    if (null == mImageProvider) {
        return false;
    }
    BitmapDrawable drawable = mImageProvider.getBitmapFromMemCache(imageTask);

    if (imageTask.getStatistics() != null) {
        imageTask.getStatistics().s0_afterCheckMemoryCache(drawable != null);
    }
    if (drawable == null) {
        return false;
    }

    if (DEBUG) {
        CLog.d(LOG_TAG, MSG_HIT_CACHE, imageTask, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
    }
    imageTask.addImageView(imageView);
    imageTask.onLoadTaskFinish(drawable, mImageLoadHandler);
    return true;
}
 
开发者ID:liaohuqiu,项目名称:cube-sdk,代码行数:24,代码来源:ImageLoader.java



注:本文中的in.srain.cube.util.CLog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DeltaIteration类代码示例发布时间:2022-05-23
下一篇:
Java IndexTemplateMetaData类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap