Ejemplo n.º 1
0
 /**
  * Sets the maximum percentage of the device's memory class for low ram devices that can be
  * taken up by Glide's {@link com.bumptech.glide.load.engine.cache.MemoryCache} and {@link
  * com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool} put together, and returns this
  * builder.
  *
  * @see ActivityManager#isLowRamDevice()
  */
 public Builder setLowMemoryMaxSizeMultiplier(float lowMemoryMaxSizeMultiplier) {
   Preconditions.checkArgument(
       lowMemoryMaxSizeMultiplier >= 0 && lowMemoryMaxSizeMultiplier <= 1,
       "Low memory max size multiplier must be between 0 and 1");
   this.lowMemoryMaxSizeMultiplier = lowMemoryMaxSizeMultiplier;
   return this;
 }
Ejemplo n.º 2
0
 @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);
 }
Ejemplo n.º 3
0
 /**
  * Sets the maximum percentage of the device's memory class for standard devices that can be
  * taken up by Glide's {@link com.bumptech.glide.load.engine.cache.MemoryCache} and {@link
  * com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool} put together, and returns this
  * builder.
  */
 public Builder setMaxSizeMultiplier(float maxSizeMultiplier) {
   Preconditions.checkArgument(
       maxSizeMultiplier >= 0 && maxSizeMultiplier <= 1,
       "Size multiplier must be between 0 and 1");
   this.maxSizeMultiplier = maxSizeMultiplier;
   return this;
 }
Ejemplo n.º 4
0
 RequestBuilder(
     GlideContext context, RequestManager requestManager, Class<TranscodeType> transcodeClass) {
   this.requestManager = requestManager;
   this.context = Preconditions.checkNotNull(context);
   this.transcodeClass = transcodeClass;
   requestOptions = context.getOptions().clone();
 }
Ejemplo n.º 5
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);
  }
Ejemplo n.º 7
0
 /**
  * Sets the number of device screens worth of pixels the {@link
  * com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool} should be able to hold and returns
  * this Builder.
  */
 public Builder setBitmapPoolScreens(float bitmapPoolScreens) {
   Preconditions.checkArgument(
       bitmapPoolScreens >= 0, "Bitmap pool screens must be greater than or equal to 0");
   this.bitmapPoolScreens = bitmapPoolScreens;
   return this;
 }
Ejemplo n.º 8
0
 /**
  * Sets the number of device screens worth of pixels the {@link
  * com.bumptech.glide.load.engine.cache.MemoryCache} should be able to hold and returns this
  * Builder.
  */
 public Builder setMemoryCacheScreens(float memoryCacheScreens) {
   Preconditions.checkArgument(
       bitmapPoolScreens >= 0, "Memory cache screens must be greater than or equal to 0");
   this.memoryCacheScreens = memoryCacheScreens;
   return this;
 }
Ejemplo n.º 9
0
 public ViewTarget(T view) {
   this.view = Preconditions.checkNotNull(view);
   sizeDeterminer = new SizeDeterminer(view);
 }
Ejemplo n.º 10
0
 public RequestBuilder<TranscodeType> transition(
     TransitionOptions<?, ? super TranscodeType> transitionOptions) {
   this.transitionOptions = Preconditions.checkNotNull(transitionOptions);
   return this;
 }