当前位置: 首页>>代码示例>>Java>>正文


Java GlideException类代码示例

本文整理汇总了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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:SingleRequestTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:SingleRequestTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:SingleRequestTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:SingleRequestTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:SingleRequestTest.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgSoftwareLayerSetter.java

示例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();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:SingleRequest.java

示例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);
}
 
开发者ID:feer921,项目名称:BaseProject,代码行数:25,代码来源:GlideImageLoader.java

示例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));
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:SingleRequest.java

示例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)));
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:MultiModelLoader.java

示例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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SingleRequestTest.java

示例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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SingleRequestTest.java

示例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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:SingleRequestTest.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:RequestFutureTarget.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:SingleRequest.java


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