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


Java RequestOptions.placeholder方法代码示例

本文整理汇总了Java中com.bumptech.glide.request.RequestOptions.placeholder方法的典型用法代码示例。如果您正苦于以下问题:Java RequestOptions.placeholder方法的具体用法?Java RequestOptions.placeholder怎么用?Java RequestOptions.placeholder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.bumptech.glide.request.RequestOptions的用法示例。


在下文中一共展示了RequestOptions.placeholder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupGlideOptions

import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
@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);
}
 
开发者ID:prashantsaini1,项目名称:titanium-android-imagepicker,代码行数:18,代码来源:ImageViewerActivity.java

示例2: onCreate

import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_intake);
    ButterKnife.bind(this);
    //setSupportActionBar(toolbar);
    intakeID = getIntent().getLongExtra("intakeID",-1);
    intakeMoment  = DataSupport.find(IntakeMoment.class,intakeID);
    medicine = DataSupport.find(Medicine.class,intakeMoment.getMedicineId());

    RequestOptions requestOptions = new RequestOptions();
    requestOptions.placeholder(R.drawable.pill_placeholder);
    requestOptions.error(R.drawable.pill_placeholder);
    requestOptions.centerCrop();
    String image_path= medicine.getImage();

    Glide.with(this).setDefaultRequestOptions(requestOptions).load(image_path).into(imageView);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle(medicine.getName());
    imageView.setBackgroundColor(getResources().getColor(R.color.grey));

    time_text.setText(String.format("%02d:%02d", intakeMoment.getStartDate().getHours(),intakeMoment.getStartDate().getMinutes()));
    seekBar.setProgress(intakeMoment.getQuantity());
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:27,代码来源:EditIntakeActivity.java

示例3: showImage

import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
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);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:19,代码来源:G.java

示例4: onBindViewHolder

import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
    final IntakeMoment intakeMoment = pillList.get(position);

    String info_pill = mContext.getString(R.string.pill_info_card,String.valueOf(intakeMoment.getQuantity()) ,
            String.valueOf(intakeMoment.getStartDate().getHours()),
            String.format("%02d",  intakeMoment.getStartDate().getMinutes()));


    holder.title.setText(intakeMoment.getMedicine().getName());
    holder.count.setText(info_pill);

    // loading album cover using Glide library
    RequestOptions requestOptions = new RequestOptions();
    requestOptions.placeholder(R.drawable.pill_placeholder);
    requestOptions.error(R.drawable.pill_placeholder);
    requestOptions.centerCrop();
    String image_path= intakeMoment.getMedicine().getImage();

    Glide.with(mContext).setDefaultRequestOptions(requestOptions).load(image_path).into(holder.thumbnail);


    holder.cardViewPill.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent i = new Intent(mContext,EditIntakeActivity.class);
            i.putExtra("intakeID", intakeMoment.getId());
            mContext.startActivity(i);
        }
    });
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:32,代码来源:PillCardAdapter.java

示例5: setImageUrl

import com.bumptech.glide.request.RequestOptions; //导入方法依赖的package包/类
/**
 * Reference : https://medium.com/fueled-android/data-binding-adapter-write-bind-repeat-50e9c64fe806
 * Bind Glide with an ImageView.
 *
 * @param view        the ImageView to bind to Glide.
 * @param src         The URL of the image to load.
 * @param placeholder The placeholder icon.
 * @param error       The error icon.
 * @param blurValue   The blur radius value between 1 and 25.
 * @param cropCircle  Crop the image in a circle of not.
 */
@SuppressWarnings("unchecked")
@android.databinding.BindingAdapter(value = {"src", "placeholder", "error", "blur", "cropCircle"},
        requireAll = false)
public void setImageUrl(ImageView view, String src, Drawable placeholder, Drawable error,
                        int blurValue, boolean cropCircle) {

    Context ctx = view.getContext();
    RequestOptions options = new RequestOptions();

    RequestBuilder<Drawable> glideBuilder = requestManager.load(src);


    if (placeholder != null) {
        options.placeholder(placeholder);
    }

    if (error != null) {
        options.error(error);
    }

    if (blurValue > 0) {
        options.transform(new BlurTransformation(ctx, blurValue));
    }

    if (cropCircle) {
        options.circleCrop();
    }

    glideBuilder
            .apply(options)
            .into(view);
}
 
开发者ID:ragdroid,项目名称:Dahaka,代码行数:44,代码来源:BindingAdapter.java


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