コード例 #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;
 }
コード例 #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);
 }
コード例 #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;
 }
コード例 #4
0
ファイル: RequestBuilder.java プロジェクト: Exlsunshine/glide
 RequestBuilder(
     GlideContext context, RequestManager requestManager, Class<TranscodeType> transcodeClass) {
   this.requestManager = requestManager;
   this.context = Preconditions.checkNotNull(context);
   this.transcodeClass = transcodeClass;
   requestOptions = context.getOptions().clone();
 }
コード例 #5
0
ファイル: RequestBuilder.java プロジェクト: Exlsunshine/glide
 public RequestBuilder<TranscodeType> apply(BaseRequestOptions requestOptions) {
   Preconditions.checkNotNull(requestOptions);
   this.requestOptions =
       DEFAULT_REQUEST_OPTIONS.equals(this.requestOptions)
           ? requestOptions
           : this.requestOptions.apply(requestOptions);
   return this;
 }
コード例 #6
0
  @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);
  }
コード例 #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;
 }
コード例 #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;
 }
コード例 #9
0
ファイル: ViewTarget.java プロジェクト: hegazy/glide
 public ViewTarget(T view) {
   this.view = Preconditions.checkNotNull(view);
   sizeDeterminer = new SizeDeterminer(view);
 }
コード例 #10
0
ファイル: RequestBuilder.java プロジェクト: Exlsunshine/glide
 public RequestBuilder<TranscodeType> transition(
     TransitionOptions<?, ? super TranscodeType> transitionOptions) {
   this.transitionOptions = Preconditions.checkNotNull(transitionOptions);
   return this;
 }