本文整理汇总了Java中in.srain.cube.util.CubeDebug类的典型用法代码示例。如果您正苦于以下问题:Java CubeDebug类的具体用法?Java CubeDebug怎么用?Java CubeDebug使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CubeDebug类属于in.srain.cube.util包,在下文中一共展示了CubeDebug类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCacheKey
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
@Override
public String getCacheKey() {
if (mCacheKey == null) {
String cacheKey = null;
String url = getRequestData().getRequestUrl();
try {
URI uri = null;
uri = new URI(url);
cacheKey = uri.getPath();
if (cacheKey.startsWith("/")) {
cacheKey = cacheKey.substring(1);
}
cacheKey = cacheKey.replace("/", "-");
} catch (URISyntaxException e) {
if (CubeDebug.DEBUG_REQUEST) {
e.printStackTrace();
}
}
if (TextUtils.isEmpty(cacheKey)) {
throw new RuntimeException("Cache key is null");
}
mCacheKey = cacheKey;
}
return mCacheKey;
}
示例2: obtain
import in.srain.cube.util.CubeDebug; //导入依赖的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;
}
示例3: tryToRecycle
import in.srain.cube.util.CubeDebug; //导入依赖的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);
}
}
}
}
}
示例4: renewForRequest
import in.srain.cube.util.CubeDebug; //导入依赖的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;
}
示例5: onCreate
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
instance = this;
String environment = "";
if (environment.equals("production")) {
CLog.setLogLevel(CLog.LEVEL_ERROR);
} else if (environment.equals("beta")) {
CLog.setLogLevel(CLog.LEVEL_WARNING);
} else {
// development
CLog.setLogLevel(CLog.LEVEL_VERBOSE);
}
CubeDebug.DEBUG_IMAGE = true;
PtrFrameLayout.DEBUG = true;
PtrFrameLayout.DEBUG = false;
ImageLoaderFactory.setDefaultImageReSizer(DemoDuiTangImageReSizer.getInstance());
ImageLoaderFactory.setDefaultImageLoadHandler(new PtrImageLoadHandler());
String dir = "request-cache";
// ImageLoaderFactory.init(this);
RequestCacheManager.init(this, dir, 1024 * 10, 1024 * 10);
Cube.onCreate(this);
}
示例6: getRemoteUrl
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
@Override
public String getRemoteUrl(ImageTask imageTask) {
String url = imageTask.getOriginUrl();
int size = findBestCDNSize(CDN_FIX_WIDTH_SIZE, imageTask.getRequestSize().x, true);
url = url.replace(TAG, TAG + DOT + size + SP + size);
if (CubeDebug.DEBUG_IMAGE) {
CLog.d("cube_image", "getRemoteUrl: %s %s", imageTask.getRequestSize(), url);
}
return url;
}
示例7: onCreate
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
instance = this;
String environment = "";
if (environment.equals("production")) {
CLog.setLogLevel(CLog.LEVEL_ERROR);
} else if (environment.equals("beta")) {
CLog.setLogLevel(CLog.LEVEL_WARNING);
} else {
// development
CLog.setLogLevel(CLog.LEVEL_VERBOSE);
}
CubeDebug.DEBUG_IMAGE = true;
PtrFrameLayout.DEBUG = true;
//PtrFrameLayout.DEBUG = false;
ImageLoaderFactory.setDefaultImageReSizer(DemoDuiTangImageReSizer.getInstance());
ImageLoaderFactory.setDefaultImageLoadHandler(new PtrImageLoadHandler());
String dir = "request-cache";
// ImageLoaderFactory.init(this);
RequestCacheManager.init(this, dir, 1024 * 10, 1024 * 10);
Cube.onCreate(this);
}
开发者ID:tangnuo,项目名称:android-Ultra-Pull-To-Refresh-With-Load-More-master,代码行数:28,代码来源:PtrDemoApplication.java
示例8: onCreate
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
instance = this;
String environment = "";
if (environment.equals("production")) {
CLog.setLogLevel(CLog.LEVEL_ERROR);
} else if (environment.equals("beta")) {
CLog.setLogLevel(CLog.LEVEL_WARNING);
} else {
// development
CLog.setLogLevel(CLog.LEVEL_VERBOSE);
}
CubeDebug.DEBUG_IMAGE = true;
PtrFrameLayout.DEBUG = true;
PtrFrameLayout.DEBUG = false;
ImageLoaderFactory.setDefaultImageReSizer(ImageReSizer.getInstance());
ImageLoaderFactory.setDefaultImageLoadHandler(new PtrImageLoadHandler());
String dir = "request-cache";
RequestCacheManager.init(this, dir, 1024 * 10, 1024 * 10);
Cube.onCreate(this);
}
示例9: getView
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (CubeDebug.DEBUG_LIST) {
CLog.d(LOG_TAG, "getView %s", position);
}
ItemDataType itemData = getItem(position);
ViewHolderBase<ItemDataType> holderBase = null;
if (mForceCreateView || convertView == null || (!(convertView.getTag() instanceof ViewHolderBase<?>))) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
holderBase = createViewHolder(position);
if (holderBase != null) {
convertView = holderBase.createView(inflater);
if (convertView != null) {
if (!mForceCreateView) {
convertView.setTag(holderBase);
}
}
}
} else {
holderBase = (ViewHolderBase<ItemDataType>) convertView.getTag();
}
if (holderBase != null) {
holderBase.setItemData(position, convertView);
holderBase.showData(position, itemData);
}
return convertView;
}
示例10: downloadAndGetInputStream
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
public FileInputStream downloadAndGetInputStream(ImageDownloader imageDownloader, ImageTask imageTask, String fileCacheKey, String url) {
if (imageDownloader == null) {
imageDownloader = SimpleDownloader.getInstance();
}
try {
CacheEntry cacheEntry = mDiskCache.beginEdit(fileCacheKey);
if (cacheEntry != null) {
OutputStream outputStream = cacheEntry.newOutputStream();
boolean ret = imageDownloader.downloadToStream(imageTask, url, outputStream, null);
if (DEBUG) {
CLog.i(LOG_TAG, "download: %s %s %s", ret, fileCacheKey, url);
}
if (ret) {
cacheEntry.commit();
InputStream inputStream = cacheEntry.getInputStream();
if (inputStream instanceof FileInputStream) {
return (FileInputStream) inputStream;
}
} else {
cacheEntry.abortEdit();
}
}
} catch (IOException e) {
if (CubeDebug.DEBUG_IMAGE) {
e.printStackTrace();
}
}
return null;
}
示例11: onRequestFail
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
@Override
public void onRequestFail(FailData failData) {
if (failData != null && failData.getRequest() != null && failData.getRequest().getRequestData() != null) {
CLog.e(CubeDebug.DEBUG_REQUEST_LOG_TAG, "onRequestFail: %s", failData.getRequest().getRequestData().getRequestUrl());
}
}
示例12: onRequestFinish
import in.srain.cube.util.CubeDebug; //导入依赖的package包/类
@Override
public void onRequestFinish(T1 data) {
if (CubeDebug.DEBUG_REQUEST) {
CLog.d(CubeDebug.DEBUG_REQUEST_LOG_TAG, "onRequestFinish: %s", data);
}
}