Java 类com.bumptech.glide.request.RequestOptions 实例源码

项目:referendum_1o_android    文件:ImageActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_image);

    Toolbar toolbar = findViewById(R.id.toolbar);

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    image = (Image) getIntent().getSerializableExtra(EXTRA_IMAGE);

    if (image == null) {
        finish();
    } else {
        TouchImageView imageView = findViewById(R.id.activity_image_image);
        Glide.with(this)
                .load(image.getUrl())
                .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
                .into(imageView);
        setTitle(image.getName());
    }
}
项目:titanium-android-imagepicker    文件:ImageViewerActivity.java   
@SuppressWarnings("unchecked")
private void setupGlideOptions() {
    options = new RequestOptions();

    if (isShapeCircle) {
        if (Defaults.CIRCLE_RADIUS > 0) {
            options.transforms(new CenterCrop(), new RoundedCorners(Defaults.CIRCLE_RADIUS));

        } else { 
            options.circleCrop();
        }
    } 

    options.override(Defaults.IMAGE_HEIGHT, Defaults.IMAGE_HEIGHT);
    options.placeholder(placeholder_image);
    options.priority(Priority.HIGH);
}
项目:text_converter    文件:ApplicationFragment.java   
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ImageView wallpaper = view.findViewById(R.id.img_wallpaper);
    ImageView icon = view.findViewById(R.id.img_icon);
    final ApplicationItem applicationItem = (ApplicationItem) getArguments().getSerializable(KEY_APP_ITEM);
    Glide.with(getContext()).load(applicationItem.getIconUrl()).apply(new RequestOptions().centerCrop()).into(icon);
    Glide.with(getContext()).load(applicationItem.getWallpaperUrl()).apply(new RequestOptions().centerCrop()).into(wallpaper);

    TextView txtName = view.findViewById(R.id.txt_name);
    txtName.setText(applicationItem.getName());

    view.findViewById(R.id.root_view).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String applicationId = applicationItem.getApplicationId();
            FirebaseAnalytics.getInstance(getActivity()).logEvent(applicationId, new Bundle());
            StoreUtil.gotoPlayStore(getActivity(), applicationId);
        }
    });
}
项目:RLibrary    文件:G.java   
public static void showImage(Activity activity, ImageView imageView, String image,
                             Drawable placeholder, boolean anim) {
    RequestOptions requestOptions = RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL);

    RequestBuilder<Drawable> builder = Glide.with(activity)
            .load(image);

    if (placeholder != null) {
        requestOptions.placeholder(placeholder);     //设置占位图片

    }
    if (!anim) {
        requestOptions.dontAnimate();
    }

    builder.apply(requestOptions);
    builder.into(imageView);
}
项目:GitHub    文件:DrawableTransformationTest.java   
/**
 * Transformations that do nothing can simply return the original Bitmap.
 */
@Test
public void load_withColorDrawable_fixedSize_requiredUnitTransform_returnsOriginalDrawable()
    throws ExecutionException, InterruptedException {
  Drawable colorDrawable = new ColorDrawable(Color.RED);

  Drawable result = Glide.with(context)
      .load(colorDrawable)
      .apply(new RequestOptions()
          .centerCrop())
      .submit(100, 100)
      .get();

  assertThat(result).isInstanceOf(ColorDrawable.class);
  assertThat(((ColorDrawable) result).getColor()).isEqualTo(Color.RED);
}
项目:Android-app    文件:VideoPlayerActivity.java   
private void updateMovieDetails(MovieOverviewModel movie){
    //Update player poster
    Glide.with(getBaseContext())
            .load("https://image.tmdb.org/t/p/w640/" + movie.getPosterPath())
            .thumbnail(1)
            .transition(withCrossFade())
            .apply(new RequestOptions()
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
            )
            .into(playerPoster);

    //Movie backdrop poster
    Glide.with(getBaseContext()).load(
            "https://image.tmdb.org/t/p/w1300_and_h730_bestv2/" + movie.getBackdropPath())
            .thumbnail(1)
            .transition(withCrossFade())
            .apply(new RequestOptions()
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
            )
            .into(backdrop);

    //Player titles
    getSupportActionBar().setTitle(movie.getTitle());
}
项目:GitHub    文件:RequestBuilder.java   
/**
 * Sets the {@link ImageView} the resource will be loaded into, cancels any existing loads into
 * the view, and frees any resources Glide may have previously loaded into the view so they may be
 * reused.
 *
 * @see RequestManager#clear(Target)
 *
 * @param view The view to cancel previous loads for and load the new resource into.
 * @return The
 * {@link com.bumptech.glide.request.target.Target} used to wrap the given {@link ImageView}.
 */
public ViewTarget<ImageView, TranscodeType> into(ImageView view) {
  Util.assertMainThread();
  Preconditions.checkNotNull(view);

  RequestOptions requestOptions = this.requestOptions;
  if (!requestOptions.isTransformationSet()
      && requestOptions.isTransformationAllowed()
      && view.getScaleType() != null) {
    // Clone in this method so that if we use this RequestBuilder to load into a View and then
    // into a different target, we don't retain the transformation applied based on the previous
    // View's scale type.
    switch (view.getScaleType()) {
      case CENTER_CROP:
        requestOptions = requestOptions.clone().optionalCenterCrop();
        break;
      case CENTER_INSIDE:
        requestOptions = requestOptions.clone().optionalCenterInside();
        break;
      case FIT_CENTER:
      case FIT_START:
      case FIT_END:
        requestOptions = requestOptions.clone().optionalFitCenter();
        break;
      case FIT_XY:
        requestOptions = requestOptions.clone().optionalCenterInside();
        break;
      case CENTER:
      case MATRIX:
      default:
        // Do nothing.
    }
  }

  return into(
      glideContext.buildImageViewTarget(view, transcodeClass),
      /*targetListener=*/ null,
      requestOptions);
}
项目:GitHub    文件:RequestBuilder.java   
private Request obtainRequest(
    Target<TranscodeType> target,
    RequestListener<TranscodeType> targetListener,
    RequestOptions requestOptions,
    RequestCoordinator requestCoordinator,
    TransitionOptions<?, ? super TranscodeType> transitionOptions,
    Priority priority,
    int overrideWidth,
    int overrideHeight) {
  return SingleRequest.obtain(
      context,
      glideContext,
      model,
      transcodeClass,
      requestOptions,
      overrideWidth,
      overrideHeight,
      priority,
      target,
      targetListener,
      requestListener,
      requestCoordinator,
      glideContext.getEngine(),
      transitionOptions.getTransitionFactory());
}
项目:GitHub    文件:GlideTest.java   
@Test
public void testLoadColorDrawable_withNonUnitBitmapTransformation_returnsBitmapDrawable() {
  ColorDrawable colorDrawable = new ColorDrawable(Color.RED);
  requestManager
      .load(colorDrawable)
      .apply(new RequestOptions()
          .override(100, 100)
          .circleCrop())
      .into(target);

  ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class);
  verify(target).onResourceReady(argumentCaptor.capture(), isA(Transition.class));

  Object result = argumentCaptor.getValue();

  assertThat(result).isInstanceOf(BitmapDrawable.class);
  Bitmap bitmap = ((BitmapDrawable) result).getBitmap();
  assertThat(bitmap.getWidth()).isEqualTo(100);
  assertThat(bitmap.getHeight()).isEqualTo(100);
}
项目:referendum_1o_android    文件:ImageAdapter.java   
@Override
public void onBindViewHolder(GenericRecyclerViewViewHolder holder, int position) {
    final Image image = imageList.get(position);

    Glide.with(holder.getView("imageView").getContext())
            .load(image.getUrl())
            .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
            .into(holder.getView("imageView", ImageView.class));

    holder.getView("imageName", TextView.class).setText(image.getName());

    holder.getView("imageView").setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onImageClickedListener.onImageClicked(image, v);
        }
    });
}
项目:LiveGiftLayout    文件:GlideLoader.java   
public GlideLoader applyDefault(int placeholderId, int errorId) {
    mRequestOptions = new RequestOptions()
            .centerCrop()
            .priority(Priority.HIGH)
            .diskCacheStrategy(DiskCacheStrategy.ALL);
    if(placeholderId != 0) {
        mRequestOptions.placeholder(placeholderId);
    }
    if(errorId != 0) {
        mRequestOptions.error(errorId);
    }
    return this;
}
项目:leisure-glance    文件:GalleryActivity.java   
@Override
public Object instantiateItem(ViewGroup container, int position) {
    if (meizis == null) {
        return null;
    }
    if (mViews == null) {
        mViews = new PhotoView[meizis.size()];
        for (int i = 0; i < 4; i++) {
            mViews[i] = new PhotoView(container.getContext());
            mViews[i].setTransitionName(meizis.get(position).get_id());
            mViews[i].setBackgroundColor(Color.BLACK);
        }
    }
    if (mViews[position] == null) {
        mViews[position] = mViews[position % 4];
    }
    container.addView(mViews[position], ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    Log.e("TAG", "addView: " + position);
    RequestOptions options = new RequestOptions()
            .format(DecodeFormat.PREFER_ARGB_8888)
            .diskCacheStrategy(DiskCacheStrategy.DATA);
    Glide.with(GalleryActivity.this)
            .load(meizis.get(position).getUrl())
            .apply(options)
            .listener(new CallbackListener(mViews[position], position))
            .into(mViews[position]);

    return mViews[position];
}
项目:GitHub    文件:GlideContext.java   
public GlideContext(Context context, Registry registry,
    ImageViewTargetFactory imageViewTargetFactory, RequestOptions defaultRequestOptions,
    Engine engine, ComponentCallbacks2 componentCallbacks, int logLevel) {
  super(context.getApplicationContext());
  this.registry = registry;
  this.imageViewTargetFactory = imageViewTargetFactory;
  this.defaultRequestOptions = defaultRequestOptions;
  this.engine = engine;
  this.componentCallbacks = componentCallbacks;
  this.logLevel = logLevel;

  mainHandler = new Handler(Looper.getMainLooper());
}
项目:TitleBarView    文件:GlideManager.java   
private static RequestOptions getRequestOptions() {
    RequestOptions requestOptions = new RequestOptions()
            .centerCrop() // 填充方式
            .priority(Priority.HIGH) //优先级
            .diskCacheStrategy(DiskCacheStrategy.ALL); //缓存策略
    return requestOptions;
}
项目:model_master    文件:GlideUtil.java   
public static void loadImageViewLodingSize(Context mContext, String path, int width, int height, ImageView mImageView, int lodingImage, int errorImageView) {

        RequestOptions options = new RequestOptions();
        final RequestOptions requestOptions = options
                .override(width, height)
                .placeholder(lodingImage)
                .error(errorImageView);
        Glide.with(mContext).load(path).apply(options).into(mImageView);
    }
项目:GitHub    文件:GifFrameLoaderTest.java   
@SuppressWarnings("unchecked")
@Test
public void testSetFrameTransformationSetsTransformationOnRequestBuilder() {
  Transformation<Bitmap> transformation = mock(Transformation.class);
  loader.setFrameTransformation(transformation, firstFrame);

  verify(requestBuilder, times(2)).apply(isA(RequestOptions.class));
}
项目:GitHub    文件:RequestBuilderTest.java   
private RequestBuilder<Object> getNullModelRequest() {
  when(glideContext.buildImageViewTarget(isA(ImageView.class), isA(Class.class)))
      .thenReturn(mock(Target.class));
  when(glideContext.getDefaultRequestOptions()).thenReturn(new RequestOptions());
  when(requestManager.getDefaultRequestOptions())
      .thenReturn((RequestOptions) new RequestOptions());
  return new RequestBuilder<>(glide, requestManager, Object.class)
      .load((Object) null);
}
项目:Android-app    文件:DiscoverListAdapter.java   
@Override
public void onBindViewHolder(ThumbHolder holder, int position) {
    final MovieOverviewModel movie = movies.get(position);

    Glide.with(mContext).load("https://image.tmdb.org/t/p/w640/" + movie.getPosterPath())
            .thumbnail(1)
            .transition(withCrossFade())
            .apply(new RequestOptions()
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
            )
            .into(holder.thumbnail);

    holder.title.setText(movie.getTitle());

    holder.container.setOnClickListener(v -> {
        lastClickedItem = position;
        Intent detailsActivityIntent = new Intent(mContext, OverviewActivity.class);

        detailsActivityIntent.setAction(OverviewActivity.MOVIE_ACTION);
        detailsActivityIntent.putExtra(OverviewActivity.MOVIE_ID, movie.getId());

        ActivityOptionsCompat options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(
                        mContext,
                        holder.thumbnail,
                        mContext.getString(R.string.gallery_transition)
                );

        mContext.startActivity(detailsActivityIntent, options.toBundle());
    });

    TableRow.LayoutParams params = new TableRow.LayoutParams(
            (int)(columnHeight * 0.66), columnHeight);

    holder.container.setLayoutParams(params);
}
项目:KomaMusic    文件:AlbumsAdapter.java   
public AlbumsAdapter(Context context, List<Album> albumList) {
    mContext = context;

    mRequestOptions = new RequestOptions().error(R.drawable.ic_album)
            .placeholder(R.drawable.ic_album);

    setList(albumList);
}
项目:UIWidget    文件:GlideManager.java   
private static RequestOptions getRequestOptions() {
    RequestOptions requestOptions = new RequestOptions()
            .centerCrop() // 填充方式
            .priority(Priority.HIGH) //优先级
            .diskCacheStrategy(DiskCacheStrategy.ALL); //缓存策略
    return requestOptions;
}
项目:model_master    文件:GlideUtil.java   
/**
 * api提供了比如:centerCrop()、fitCenter()等
 */

//设置动态转换
public static void loadImageViewCrop(Context mContext, String path, ImageView mImageView) {

    RequestOptions options = new RequestOptions();
    final RequestOptions requestOptions = options.centerCrop();
    Glide.with(mContext).load(path).apply(requestOptions).into(mImageView);
}
项目:Camera-Roll-Android-App    文件:InfoRecyclerViewAdapter.java   
private void retrieveColors(final Uri uri) {
    if (uri == null) {
        return;
    }

    int[] imageDimens = Util
            .getImageDimensions(itemView.getContext(), uri);

    RequestOptions options = new RequestOptions()
            .skipMemoryCache(true)
            .override((int) (imageDimens[0] * 0.1f), (int) (imageDimens[1] * 0.1f))
            .diskCacheStrategy(DiskCacheStrategy.NONE);

    Glide.with(itemView.getContext())
            .asBitmap()
            .load(uri)
            .apply(options)
            .into(new SimpleTarget<Bitmap>() {
                @Override
                public void onResourceReady(final Bitmap bitmap, com.bumptech.glide.request
                        .transition.Transition<? super Bitmap> transition) {
                    // Do something with bitmap here.
                    Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
                        @Override
                        public void onGenerated(Palette palette) {
                            p = palette;
                            setColors(null);
                        }
                    });
                }
            });
}
项目:FastLib    文件:GlideManager.java   
private static RequestOptions getRequestOptions() {
    RequestOptions requestOptions = new RequestOptions()
            .centerCrop() // 填充方式
            .priority(Priority.HIGH) //优先级
            .diskCacheStrategy(DiskCacheStrategy.ALL); //缓存策略
    return requestOptions;
}
项目:ViewPagerHelper    文件:GlideManager.java   
public GlideManager(Builder builder){
    RequestOptions options = new RequestOptions()
            .placeholder(builder.placeresid);

    if (builder.eroorresid != 0){
        options.error(builder.eroorresid);
    }


    switch (builder.type){
        case BITMAP_SCAN_CENTERN:
            options.centerCrop();
            break;
        case BITMAP_SCAN_FIT:
            options.fitCenter();
            break;
        default:
            break;
    }
    if (builder.setCircleCrop){
        options.circleCrop();
    }
    if (builder.radius != 0){
        options.transform(new RoundedCorners(builder.radius));
    }

    RequestBuilder requestBuilder = null;

    requestBuilder = Glide.with(builder.context).load(builder.source);

    if (builder.animtime > 0){
        requestBuilder.transition(new DrawableTransitionOptions().crossFade(builder.animtime));
    }

    requestBuilder.apply(options)
            .listener(new LoadListener())
            .into(builder.imageView);


}
项目:KomaMusic    文件:PlaylistAdapter.java   
public PlaylistAdapter(Context context, List<Playlist> playlists) {
    mContext = context;

    mRequestOptions = new RequestOptions().error(R.drawable.ic_album)
            .placeholder(R.drawable.ic_album);

    setList(playlists);
}
项目:Protein    文件:ShotGridSimpleModel.java   
@Override
public void bind(ShotGridSimpleHolder holder) {
    super.bind(holder);

    int placeholder = 0;
    switch (adapterPosition % 6) {
        case 0:
            placeholder = R.color.shot_image_placeholder_8;
            break;
        case 1:
            placeholder = R.color.shot_image_placeholder_12;
            break;
        case 2:
            placeholder = R.color.shot_image_placeholder_14;
            break;
        case 3:
        case 4:
            placeholder = R.color.shot_image_placeholder_20;
            break;
        case 5:
            placeholder = R.color.shot_image_placeholder_16;
            break;
    }

    RequestOptions requestOptions = RequestOptions.placeholderOf(placeholder)
            .diskCacheStrategy(DiskCacheStrategy.ALL);
    Glide.with(context)
            .load(shot.images().best())
            .transition(transitionOptions)
            .apply(requestOptions)
            .into(new DribbbleTarget(holder.shotImage));

    holder.shotImage.showBadge(shot.animated());

    holder.shotImage.setTag(R.id.clicked_model, shot);
    holder.shotImage.setOnClickListener(shotOnClickListener);
}
项目:BLPlayer    文件:BannerLayout.java   
@NonNull
private ImageView getImageView(Integer res, final int position) {
    ImageView imageView = new ImageView(getContext());
    imageView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (onBannerItemClickListener != null) {
                onBannerItemClickListener.onItemClick(position);
            }
        }
    });
    imageView.setScaleType(getScaleType(imageScaleType));
    Glide.with(getContext()).load(res).apply(new RequestOptions().fitCenter()).into(imageView);
    return imageView;
}
项目:GitHub    文件:RequestBuilderTest.java   
private RequestBuilder<Object> getNullModelRequest() {
  when(glideContext.buildImageViewTarget(isA(ImageView.class), isA(Class.class)))
      .thenReturn(mock(ViewTarget.class));
  when(glideContext.getDefaultRequestOptions()).thenReturn(new RequestOptions());
  when(requestManager.getDefaultRequestOptions())
      .thenReturn(new RequestOptions());
  when(requestManager.getDefaultTransitionOptions(any(Class.class)))
      .thenReturn(new GenericTransitionOptions<>());
  return new RequestBuilder<>(glide, requestManager, Object.class, context)
      .load((Object) null);
}
项目:GitHub    文件:DrawableTransformationTest.java   
@Test
public void load_withColorDrawable_sizeOriginal_optionalTransform_returnsColorDrawable()
    throws ExecutionException, InterruptedException {
  Drawable colorDrawable = new ColorDrawable(Color.RED);
  Drawable result = Glide.with(context)
      .load(colorDrawable)
      .apply(new RequestOptions()
          .optionalCenterCrop())
      .submit()
      .get();

  assertThat(result).isInstanceOf(ColorDrawable.class);
  assertThat(((ColorDrawable) result).getColor()).isEqualTo(Color.RED);
}
项目:GitHub    文件:DrawableTransformationTest.java   
/**
 * Transformations that produce a different output color/shape/image etc will end up returning
 * a {@link Bitmap} based on the original {@link Drawable} but with the transformation applied.
 */
@Test
public void load_withColorDrawable_fixedSize_nonUnitRequiredTransform_returnsBitmapDrawable()
    throws ExecutionException, InterruptedException {
  Drawable colorDrawable = new ColorDrawable(Color.RED);

  Drawable result = Glide.with(context)
      .load(colorDrawable)
      .apply(new RequestOptions()
          .circleCrop())
      .submit(100, 100)
      .get();

  Bitmap redSquare = Bitmap.createBitmap(100, 100, Config.ARGB_8888);
  Canvas canvas = new Canvas(redSquare);
  canvas.drawColor(Color.RED);

  BitmapPool bitmapPool = mock(BitmapPool.class);
  when(bitmapPool.get(100, 100, Bitmap.Config.ARGB_8888))
      .thenReturn(Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888));
  Bitmap expected = TransformationUtils.circleCrop(bitmapPool, redSquare, 100, 100);

  assertThat(result).isInstanceOf(BitmapDrawable.class);
  Bitmap bitmap = ((BitmapDrawable) result).getBitmap();
  assertThat(bitmap.getWidth()).isEqualTo(100);
  assertThat(bitmap.getHeight()).isEqualTo(100);
  for (int x = 0; x < bitmap.getWidth(); x++) {
    for (int y = 0; y < bitmap.getHeight(); y++) {
      assertThat(bitmap.getPixel(x, y)).isEqualTo(expected.getPixel(x, y));
    }
  }
}
项目:GitHub    文件:DrawableTransformationTest.java   
@Test
public void load_withColorDrawable_sizeOriginal_requiredTransform_fails()
    throws ExecutionException, InterruptedException {
  Drawable colorDrawable = new ColorDrawable(Color.RED);

  expectedException.expect(ExecutionException.class);
  Glide.with(context)
      .load(colorDrawable)
      .apply(new RequestOptions()
          .centerCrop())
      .submit()
      .get();
}
项目:RabbitCloud    文件:LoaderImage.java   
public static void loadLiveItemImg(Context context, String url, ImageView view) {
    Glide.with(context).load(url)
            .apply(new RequestOptions()
                    .centerCrop()
                    .placeholder(R.drawable.nodata_img_panda)
                    .diskCacheStrategy(DiskCacheStrategy.RESOURCE))
            .into(view);
}
项目:ePills    文件:AddPillGeneralActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (data != null && requestCode == GALLERY_PICK) {
        Uri selectedImageURI = data.getData();
        mCurrentPhotoPath = getRealPathFromURI(selectedImageURI);
    }
    if((requestCode == GALLERY_PICK || requestCode == REQUEST_IMAGE_CAPTURE) && resultCode == RESULT_OK){
        Glide.with(this)
                .load(mCurrentPhotoPath)
                .apply(RequestOptions.centerCropTransform())
                .into(imageView);
    }
}
项目:Android-app    文件:PersonView.java   
public void setProfilePhoto(String personPhoto){
    Glide.with(context).load("https://image.tmdb.org/t/p/w640/" + personPhoto)
            .thumbnail(1)
            .transition(withCrossFade())
            .apply(new RequestOptions()
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
            )
            .into(profilePhoto);
}
项目:GitHub    文件:RequestBuilder.java   
private <Y extends Target<TranscodeType>> Y into(
    @NonNull Y target,
    @Nullable RequestListener<TranscodeType> targetListener,
    RequestOptions options) {
  Util.assertMainThread();
  Preconditions.checkNotNull(target);
  if (!isModelSet) {
    throw new IllegalArgumentException("You must call #load() before calling #into()");
  }

  options = options.autoClone();
  Request request = buildRequest(target, targetListener, options);

  Request previous = target.getRequest();
  if (request.isEquivalentTo(previous)) {
    request.recycle();
    // If the request is completed, beginning again will ensure the result is re-delivered,
    // triggering RequestListeners and Targets. If the request is failed, beginning again will
    // restart the request, giving it another chance to complete. If the request is already
    // running, we can let it continue running without interruption.
    if (!Preconditions.checkNotNull(previous).isRunning()) {
      // Use the previous request rather than the new one to allow for optimizations like skipping
      // setting placeholders, tracking and untracking Targets, and obtaining View dimensions that
      // are done in the individual Request.
      previous.begin();
    }
    return target;
  }

  requestManager.clear(target);
  target.setRequest(request);
  requestManager.track(target, request);

  return target;
}
项目:GitHub    文件:RequestBuilder.java   
private Request buildRequest(
    Target<TranscodeType> target,
    @Nullable RequestListener<TranscodeType> targetListener,
    RequestOptions requestOptions) {
  return buildRequestRecursive(
      target,
      targetListener,
      /*parentCoordinator=*/ null,
      transitionOptions,
      requestOptions.getPriority(),
      requestOptions.getOverrideWidth(),
      requestOptions.getOverrideHeight(),
      requestOptions);
}
项目:KomaMusic    文件:SongsAdapter.java   
public SongsAdapter(Context context, List<Song> songs) {
    mContext = context;

    mRequestOptions = new RequestOptions().error(R.drawable.ic_album)
            .placeholder(R.drawable.ic_album);

    setList(songs);
}
项目:GitHub    文件:GifFrameLoaderTest.java   
@SuppressWarnings("unchecked")
@Test
public void testSetFrameTransformationSetsTransformationOnRequestBuilder() {
  verify(requestBuilder, times(2)).apply(isA(RequestOptions.class));
  Transformation<Bitmap> transformation = mock(Transformation.class);
  loader.setFrameTransformation(transformation, firstFrame);

  verify(requestBuilder, times(3)).apply(isA(RequestOptions.class));
}
项目:RabbitCloud    文件:LoaderImage.java   
private static RequestOptions getLiveRequestOptions() {
    return new RequestOptions()
            .placeholder(R.drawable.home_list_item_bg)
            .centerInside()
            .diskCacheStrategy(DiskCacheStrategy.RESOURCE);
}
项目:GitHub    文件:RequestManager.java   
protected void setRequestOptions(@NonNull RequestOptions toSet) {
  this.requestOptions = toSet.clone().autoClone();
}