本文整理汇总了Java中com.bumptech.glide.DrawableTypeRequest.placeholder方法的典型用法代码示例。如果您正苦于以下问题:Java DrawableTypeRequest.placeholder方法的具体用法?Java DrawableTypeRequest.placeholder怎么用?Java DrawableTypeRequest.placeholder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bumptech.glide.DrawableTypeRequest
的用法示例。
在下文中一共展示了DrawableTypeRequest.placeholder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadNet
import com.bumptech.glide.DrawableTypeRequest; //导入方法依赖的package包/类
@Override
public void loadNet(Context context, String url, Options options, final LoadCallback callback) {
DrawableTypeRequest request = getRequestManager(context).load(url);
if (options == null) options = Options.defaultOptions();
if (options.loadingResId != Options.RES_NONE) {
request.placeholder(options.loadingResId);
}
if (options.loadErrorResId != Options.RES_NONE) {
request.error(options.loadErrorResId);
}
wrapScaleType(request, options)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.crossFade()
.into(new SimpleTarget<GlideBitmapDrawable>() {
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
if (callback != null) {
callback.onLoadFailed(e);
}
}
@Override
public void onResourceReady(GlideBitmapDrawable resource, GlideAnimation<? super GlideBitmapDrawable> glideAnimation) {
if (resource != null && resource.getBitmap() != null) {
if (callback != null) {
callback.onLoadReady(resource.getBitmap());
}
}
}
});
}
示例2: load
import com.bumptech.glide.DrawableTypeRequest; //导入方法依赖的package包/类
private void load(DrawableTypeRequest request, ImageView target, Options options) {
if (options == null) options = Options.defaultOptions();
if (options.loadingResId != Options.RES_NONE) {
request.placeholder(options.loadingResId);
}
if (options.loadErrorResId != Options.RES_NONE) {
request.error(options.loadErrorResId);
}
wrapScaleType(request, options)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.crossFade()
.into(target);
}
示例3: loadNet
import com.bumptech.glide.DrawableTypeRequest; //导入方法依赖的package包/类
@Override
public void loadNet(Context context, String url, Options options, final LoadCallback callback) {
DrawableTypeRequest request = getRequestManager(context).load(url);
if (options == null) options = Options.defaultOptions();
if (options.loadingResId != Options.RES_NONE) {
request.placeholder(options.loadingResId);
}
if (options.loadErrorResId != Options.RES_NONE) {
request.error(options.loadErrorResId);
}
request.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.crossFade()
.into(new SimpleTarget<GlideBitmapDrawable>() {
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
if (callback != null) {
callback.onLoadFailed(e);
}
}
@Override
public void onResourceReady(GlideBitmapDrawable resource, GlideAnimation<? super GlideBitmapDrawable> glideAnimation) {
if (resource != null && resource.getBitmap() != null) {
if (callback != null) {
callback.onLoadReady(resource.getBitmap());
}
}
}
});
}
示例4: load
import com.bumptech.glide.DrawableTypeRequest; //导入方法依赖的package包/类
private void load(DrawableTypeRequest request, ImageView target, Options options) {
if (options == null) options = Options.defaultOptions();
if (options.loadingResId != Options.RES_NONE) {
request.placeholder(options.loadingResId);
}
if (options.loadErrorResId != Options.RES_NONE) {
request.error(options.loadErrorResId);
}
request.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.crossFade()
.into(target);
}
示例5: load
import com.bumptech.glide.DrawableTypeRequest; //导入方法依赖的package包/类
private void load(DrawableTypeRequest request, ImageView target, Options options) {
if (options == null) options = Options.defaultOptions();
if (options.loadingResId != Options.RES_NONE) {
request.placeholder(options.loadingResId);
}
if (options.loadErrorResId != Options.RES_NONE) {
request.error(options.loadErrorResId);
}
request.crossFade().into(target);
}
示例6: onPrepareRequest
import com.bumptech.glide.DrawableTypeRequest; //导入方法依赖的package包/类
/**
* Prepares loading request with configuration based on this task's parameters.
*
* @param requestManager Manager used to create the request.
* @return Prepared image loading request to be executed.
*/
@NonNull
protected DrawableTypeRequest<String> onPrepareRequest(@NonNull RequestManager requestManager) {
final DrawableTypeRequest<String> request = requestManager.load(mTarget);
if (mPlaceholderRes != NO_RESOURCE_ID) request.error(mPlaceholderRes);
if (mPlaceholder != null) request.error(mPlaceholder);
if (mErrorRes != NO_RESOURCE_ID) request.placeholder(mErrorRes);
if (mError != null) request.placeholder(mError);
if (mTransformation != null) request.transform(mTransformation);
if (hasRequest(REQUEST_DO_NOT_ANIMATE)) request.dontAnimate();
return request;
}
示例7: loadImage
import com.bumptech.glide.DrawableTypeRequest; //导入方法依赖的package包/类
@BindingAdapter(value = {"url","placeholder"},requireAll = false)
public static void loadImage(ImageView view, String url,int placeHolder) {
DrawableTypeRequest<String> load = Glide.with(view.getContext()).load(url);
if (0!= placeHolder){
load.placeholder(placeHolder);
}
load.into(view);
}