use of com.bumptech.glide.request.RequestOptions in project glide by bumptech.
the class DrawableTransformationTest method load_withColorDrawable_sizeOriginal_optionalTransform_returnsColorDrawable.
@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);
}
use of com.bumptech.glide.request.RequestOptions in project MyBaseApplication by BanShouWeng.
the class GlideUtils method loadImageViewLoding.
// 设置加载中以及加载失败图片
public static void loadImageViewLoding(Context mContext, String path, ImageView mImageView, int lodingImage, int errorImageView) {
RequestOptions options = new RequestOptions().centerCrop().placeholder(lodingImage).error(errorImageView);
Glide.with(mContext).load(path).apply(options).into(mImageView);
}
use of com.bumptech.glide.request.RequestOptions in project MyBaseApplication by BanShouWeng.
the class GlideUtils method loadImageViewSize.
// 加载指定大小
public static void loadImageViewSize(Context mContext, String path, int width, int height, ImageView mImageView) {
RequestOptions options = new RequestOptions().centerCrop().override(width, height);
Glide.with(mContext).load(path).apply(options).into(mImageView);
}
use of com.bumptech.glide.request.RequestOptions in project MyBaseApplication by BanShouWeng.
the class GlideUtils method loadImageViewCrop.
/**
* api提供了比如:centerCrop()、fitCenter()等
*/
// 设置动态转换
public static void loadImageViewCrop(Context mContext, String path, ImageView mImageView) {
RequestOptions options = new RequestOptions().centerCrop();
Glide.with(mContext).load(path).apply(options).into(mImageView);
}
use of com.bumptech.glide.request.RequestOptions in project Habba18 by chiragsastry1996.
the class FeedAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
final Feed feed = feedList.get(position);
holder.nameTextView.setText(feed.getName());
holder.ageTextView.setText(feed.getCaption());
if (feed.getImage().contains("http://acharyahabba.in/habba18/admin/feeds")) {
holder.relativeLayout.setVisibility(View.GONE);
holder.playButton.setVisibility(View.GONE);
Glide.with(mContext).load(feed.getImage()).apply(new RequestOptions().placeholder(R.drawable.loader)).into(holder.imageView);
} else {
Glide.with(mContext).load("https://img.youtube.com/vi/" + feed.getImage() + "/0.jpg").into(holder.imageView);
System.out.println("youtube " + "https://img.youtube.com/vi/" + feed.getImage() + "/0.jpg");
holder.relativeLayout.setVisibility(View.VISIBLE);
holder.playButton.setVisibility(View.VISIBLE);
holder.playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle args = new Bundle();
args.putString("url", feed.getImage());
args.putString("name", feed.getName());
args.putString("caption", feed.getCaption());
YoutubeFragment youtube = new YoutubeFragment();
youtube.setArguments(args);
((AppCompatActivity) mContext).getSupportFragmentManager().beginTransaction().add(R.id.frameContainer, youtube).addToBackStack(null).commit();
}
});
}
}
Aggregations