use of com.bumptech.glide.request.RequestOptions in project glide by bumptech.
the class RequestBuilderTest method getNullModelRequest.
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);
}
use of com.bumptech.glide.request.RequestOptions in project glide by bumptech.
the class GlideContextTest method setUp.
@Before
public void setUp() {
Application app = RuntimeEnvironment.application;
transitionOptions = new HashMap<>();
context = new GlideContext(app, new LruArrayPool(), new Registry(), new ImageViewTargetFactory(), new RequestOptions(), transitionOptions, mock(Engine.class), Log.DEBUG);
}
use of com.bumptech.glide.request.RequestOptions in project glide by bumptech.
the class MainActivity method showContact.
private void showContact(long id) {
GlideRequests glideRequests = GlideApp.with(this);
RequestOptions originalSize = new RequestOptions().override(Target.SIZE_ORIGINAL);
Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);
glideRequests.load(contactUri).apply(originalSize).into(imageViewContact);
Uri lookupUri = Contacts.getLookupUri(getContentResolver(), contactUri);
glideRequests.load(lookupUri).apply(originalSize).into(imageViewLookup);
Uri photoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.CONTENT_DIRECTORY);
glideRequests.load(photoUri).apply(originalSize).into(imageViewPhoto);
Uri displayPhotoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.DISPLAY_PHOTO);
glideRequests.load(displayPhotoUri).apply(originalSize).into(imageViewDisplayPhoto);
}
use of com.bumptech.glide.request.RequestOptions in project BGARefreshLayout-Android by bingoogolapple.
the class StaggeredRecyclerViewAdapter method fillData.
@Override
public void fillData(BGAViewHolderHelper viewHolderHelper, int position, StaggeredModel model) {
viewHolderHelper.setText(R.id.tv_item_staggered_desc, model.desc);
// 这里不知道当前图片的尺寸,加载成功后会乱跳
Glide.with(mContext).load(model.icon).apply(new RequestOptions().placeholder(R.mipmap.staggered_holder).error(R.mipmap.staggered_holder).dontAnimate()).into((ImageView) viewHolderHelper.getView(R.id.iv_item_staggered_icon));
}
use of com.bumptech.glide.request.RequestOptions in project BGARefreshLayout-Android by bingoogolapple.
the class DataEngine method getCustomHeaderView.
public static View getCustomHeaderView(final Context context) {
View headerView = View.inflate(context, R.layout.view_custom_header, null);
final BGABanner banner = headerView.findViewById(R.id.banner);
banner.setAdapter(new BGABanner.Adapter<ImageView, String>() {
@Override
public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
Glide.with(itemView.getContext()).load(model).apply(new RequestOptions().placeholder(R.mipmap.holder).error(R.mipmap.holder).dontAnimate().centerCrop()).into(itemView);
}
});
banner.setDelegate(new BGABanner.Delegate<ImageView, String>() {
@Override
public void onBannerItemClick(BGABanner banner, ImageView imageView, String model, int position) {
Toast.makeText(banner.getContext(), "点击了第" + (position + 1) + "页", Toast.LENGTH_SHORT).show();
}
});
App.getInstance().getEngine().getBannerModel().enqueue(new Callback<BannerModel>() {
@Override
public void onResponse(Call<BannerModel> call, Response<BannerModel> response) {
BannerModel bannerModel = response.body();
if (bannerModel == null) {
return;
}
banner.setData(R.layout.view_image, bannerModel.imgs, bannerModel.tips);
}
@Override
public void onFailure(Call<BannerModel> call, Throwable t) {
}
});
return headerView;
}
Aggregations