本文整理汇总了Java中com.bumptech.glide.load.engine.GlideException类的典型用法代码示例。如果您正苦于以下问题:Java GlideException类的具体用法?Java GlideException怎么用?Java GlideException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GlideException类属于com.bumptech.glide.load.engine包,在下文中一共展示了GlideException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCallsTargetOnExceptionIfNoRequestListener
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Test
public void testCallsTargetOnExceptionIfNoRequestListener() {
harness.requestListener = null;
SingleRequest<List> request = harness.getRequest();
request.onLoadFailed(new GlideException("test"));
verify(harness.target).onLoadFailed(eq(harness.errorDrawable));
}
示例2: testCallsTargetOnExceptionIfRequestListenerReturnsFalse
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Test
public void testCallsTargetOnExceptionIfRequestListenerReturnsFalse() {
SingleRequest<List> request = harness.getRequest();
when(harness.requestListener.onLoadFailed(isAGlideException(), any(Number.class),
eq(harness.target), anyBoolean()))
.thenReturn(false);
request.onLoadFailed(new GlideException("test"));
verify(harness.target).onLoadFailed(eq(harness.errorDrawable));
}
示例3: testDoesNotCallTargetOnExceptionIfRequestListenerReturnsTrue
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Test
public void testDoesNotCallTargetOnExceptionIfRequestListenerReturnsTrue() {
SingleRequest<List> request = harness.getRequest();
when(harness.requestListener.onLoadFailed(isAGlideException(), any(Number.class),
eq(harness.target), anyBoolean()))
.thenReturn(true);
request.onLoadFailed(new GlideException("test"));
verify(harness.target, never()).onLoadFailed(any(Drawable.class));
}
示例4: testDoesNotSetErrorDrawableIfRequestCoordinatorDoesntAllowIt
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Test
public void testDoesNotSetErrorDrawableIfRequestCoordinatorDoesntAllowIt() {
harness.errorDrawable = new ColorDrawable(Color.RED);
SingleRequest<List> request = harness.getRequest();
when(harness.requestCoordinator.canNotifyStatusChanged(any(Request.class))).thenReturn(false);
request.onLoadFailed(new GlideException("test"));
verify(harness.target, never()).onLoadFailed(any(Drawable.class));
}
示例5: testErrorDrawableIsSetOnLoadFailed
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Test
public void testErrorDrawableIsSetOnLoadFailed() {
Drawable expected = new ColorDrawable(Color.RED);
MockTarget target = new MockTarget();
harness.errorDrawable = expected;
harness.target = target;
SingleRequest<List> request = harness.getRequest();
request.onLoadFailed(new GlideException("test"));
assertEquals(expected, target.currentPlaceholder);
}
示例6: onLoadFailed
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
boolean isFirstResource) {
ImageView view = ((ImageViewTarget<?>) target).getView();
view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
return false;
}
示例7: onLoadFailed
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
private void onLoadFailed(GlideException e, int maxLogLevel) {
stateVerifier.throwIfRecycled();
int logLevel = glideContext.getLogLevel();
if (logLevel <= maxLogLevel) {
Log.w(GLIDE_TAG, "Load failed for " + model + " with size [" + width + "x" + height + "]", e);
if (logLevel <= Log.INFO) {
e.logRootCauses(GLIDE_TAG);
}
}
loadStatus = null;
status = Status.FAILED;
//TODO: what if this is a thumbnail request?
if (requestListener == null
|| !requestListener.onLoadFailed(e, model, target, isFirstReadyResource())) {
setErrorPlaceholder();
}
}
示例8: addProgressListener
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
private void addProgressListener() {
if (getImageUrl() == null) return;
final String url = getImageUrl();
if (!url.startsWith(HTTP)) return;
internalProgressListener = new OnProgressListener() {
@Override
public void onProgress(String imageUrl, long bytesRead, long totalBytes, boolean isDone, GlideException exception) {
if (totalBytes == 0) return;
if (!url.equals(imageUrl)) return;
if (mLastBytesRead == bytesRead && mLastStatus == isDone) return;
mLastBytesRead = bytesRead;
mTotalBytes = totalBytes;
mLastStatus = isDone;
mainThreadCallback(bytesRead, totalBytes, isDone, exception);
if (isDone) {
ProgressManager.removeProgressListener(this);
}
}
};
ProgressManager.addProgressListener(internalProgressListener);
}
示例9: begin
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Override
public void begin() {
stateVerifier.throwIfRecycled();
startTime = LogTime.getLogTime();
if (model == null) {
if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
width = overrideWidth;
height = overrideHeight;
}
// Only log at more verbose log levels if the user has set a fallback drawable, because
// fallback Drawables indicate the user expects null models occasionally.
int logLevel = getFallbackDrawable() == null ? Log.WARN : Log.DEBUG;
onLoadFailed(new GlideException("Received null model"), logLevel);
return;
}
status = Status.WAITING_FOR_SIZE;
if (Util.isValidDimensions(overrideWidth, overrideHeight)) {
onSizeReady(overrideWidth, overrideHeight);
} else {
target.getSize(this);
}
if ((status == Status.RUNNING || status == Status.WAITING_FOR_SIZE)
&& canNotifyStatusChanged()) {
target.onLoadStarted(getPlaceholderDrawable());
}
if (Log.isLoggable(TAG, Log.VERBOSE)) {
logV("finished run method in " + LogTime.getElapsedMillis(startTime));
}
}
示例10: startNextOrFail
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
private void startNextOrFail() {
if (currentIndex < fetchers.size() - 1) {
currentIndex++;
loadData(priority, callback);
} else {
callback.onLoadFailed(new GlideException("Fetch failed", new ArrayList<>(exceptions)));
}
}
示例11: testIsFailedAfterException
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Test
public void testIsFailedAfterException() {
SingleRequest<List> request = harness.getRequest();
request.onLoadFailed(new GlideException("test"));
assertTrue(request.isFailed());
}
示例12: testIsFailedAfterNoResultAndNullException
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Test
public void testIsFailedAfterNoResultAndNullException() {
SingleRequest<List> request = harness.getRequest();
request.onLoadFailed(new GlideException("test"));
assertTrue(request.isFailed());
}
示例13: testIsNotRunningAfterFailing
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Test
public void testIsNotRunningAfterFailing() {
SingleRequest<List> request = harness.getRequest();
request.begin();
request.onLoadFailed(new GlideException("test"));
assertFalse(request.isRunning());
}
示例14: onLoadFailed
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
@Override
public synchronized boolean onLoadFailed(
@Nullable GlideException e, Object model, Target<R> target, boolean isFirstResource) {
loadFailed = true;
exception = e;
waiter.notifyAll(this);
return false;
}
示例15: onLoadFailed
import com.bumptech.glide.load.engine.GlideException; //导入依赖的package包/类
private void onLoadFailed(GlideException e, int maxLogLevel) {
stateVerifier.throwIfRecycled();
int logLevel = glideContext.getLogLevel();
if (logLevel <= maxLogLevel) {
Log.w(GLIDE_TAG, "Load failed for " + model + " with size [" + width + "x" + height + "]", e);
if (logLevel <= Log.INFO) {
e.logRootCauses(GLIDE_TAG);
}
}
loadStatus = null;
status = Status.FAILED;
isCallingCallbacks = true;
try {
//TODO: what if this is a thumbnail request?
if ((requestListener == null
|| !requestListener.onLoadFailed(e, model, target, isFirstReadyResource()))
&& (targetListener == null
|| !targetListener.onLoadFailed(e, model, target, isFirstReadyResource()))) {
setErrorPlaceholder();
}
} finally {
isCallingCallbacks = false;
}
notifyLoadFailed();
}