@Implementation
 public static Bitmap createBitmap(int width, int height, Bitmap.Config config) {
   // Robolectric doesn't match the framework behavior with null configs, so we have to do so
   // here.
   Preconditions.checkNotNull("Config must not be null");
   return ShadowBitmap.createBitmap(width, height, config);
 }
Esempio n. 2
0
 RequestBuilder(
     GlideContext context, RequestManager requestManager, Class<TranscodeType> transcodeClass) {
   this.requestManager = requestManager;
   this.context = Preconditions.checkNotNull(context);
   this.transcodeClass = transcodeClass;
   requestOptions = context.getOptions().clone();
 }
Esempio n. 3
0
 public RequestBuilder<TranscodeType> apply(BaseRequestOptions requestOptions) {
   Preconditions.checkNotNull(requestOptions);
   this.requestOptions =
       DEFAULT_REQUEST_OPTIONS.equals(this.requestOptions)
           ? requestOptions
           : this.requestOptions.apply(requestOptions);
   return this;
 }
  @SuppressWarnings("unchecked")
  public synchronized <T> DataRewinder<T> build(T data) {
    Preconditions.checkNotNull(data);
    DataRewinder.Factory result = rewinders.get(data.getClass());
    if (result == null) {
      for (DataRewinder.Factory<?> registeredFactory : rewinders.values()) {
        if (registeredFactory.getDataClass().isAssignableFrom(data.getClass())) {
          result = registeredFactory;
          break;
        }
      }
    }

    if (result == null) {
      result = DEFAULT_FACTORY;
    }
    return result.build(data);
  }
Esempio n. 5
0
 public ViewTarget(T view) {
   this.view = Preconditions.checkNotNull(view);
   sizeDeterminer = new SizeDeterminer(view);
 }
Esempio n. 6
0
 public RequestBuilder<TranscodeType> transition(
     TransitionOptions<?, ? super TranscodeType> transitionOptions) {
   this.transitionOptions = Preconditions.checkNotNull(transitionOptions);
   return this;
 }