本文整理汇总了Java中com.squareup.picasso.RequestCreator.error方法的典型用法代码示例。如果您正苦于以下问题:Java RequestCreator.error方法的具体用法?Java RequestCreator.error怎么用?Java RequestCreator.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.squareup.picasso.RequestCreator
的用法示例。
在下文中一共展示了RequestCreator.error方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadImage
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
/**
* Loads an image into a target view.
* @param context context
* @param image image
* @param centerCrop boolean
* @param errorResourceId image of error
* @param target imageView
* @param callback callback
*/
public static void loadImage(final Context context, final String image,
final boolean centerCrop, final int errorResourceId,
final ImageView target, final Callback callback) {
Picasso pic = Picasso.with(context);
RequestCreator request;
int errorRId = errorResourceId;
if (image != null )
request = pic.load(image).fit();
else {
request = pic.load(errorResourceId).fit();
errorRId = 0;
}
if (centerCrop)
request = request.centerCrop();
if (errorRId != 0)
request = request.error(errorResourceId);
if (callback != null)
request.into(target, callback);
else
request.into(target);
}
示例2: loadOptions
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private RequestCreator loadOptions(RequestCreator requestCreator) {
if (options == null) {
return requestCreator;
}
if (options.targetHeight > 0 && options.targetWidth > 0) {
requestCreator.resize(options.targetWidth, options.targetHeight);
}
if (options.isCenterInside) {
requestCreator.centerInside();
} else if (options.isCenterCrop) {
requestCreator.centerCrop();
}
if (options.config != null) {
requestCreator.config(options.config);
}
if (options.errorResId != 0) {
requestCreator.error(options.errorResId);
}
if (options.placeholderResId != 0) {
requestCreator.placeholder(options.placeholderResId);
}
if (options.bitmapAngle != 0) {
requestCreator.transform(new PicassoTransformation(options.bitmapAngle));
}
return requestCreator;
}
示例3: setPicasso
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
public static void setPicasso(Context context, Uri url, ImageView imageView, @DrawableRes int placeHolder) {
Picasso picasso = Picasso.with(context);
if (BuildConfig.DEBUG)
picasso.setLoggingEnabled(true);
RequestCreator requestCreator = picasso.load(url);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
requestCreator.placeholder(placeHolder);
requestCreator.error(placeHolder);
} else {
Drawable drawable = AppCompatDrawableManager.get().getDrawable(context, placeHolder);
requestCreator.placeholder(drawable);
requestCreator.error(drawable);
}
requestCreator.into(imageView);
}
示例4: displayNoScaling
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
public static void displayNoScaling(ImageView imageView, String uri, boolean fadeIn, int stubImage, ImageLoaderListener listener)
{
if (uri == null || uri.length() == 0)
uri = FAKE_URI;
Picasso picasso = Picasso.with(imageView.getContext());
RequestCreator requestCreator = picasso.load(uri);
if (stubImage != 0)
{
requestCreator.placeholder(stubImage);
requestCreator.error(stubImage);
}
if (!(fadeIn && FADE_ENABLED))
requestCreator.noFade();
requestCreator.into(imageView, listener);
}
示例5: processResId
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private static RequestCreator processResId(RequestCreator taget, int placeholderResId, int errorResId) {
if (0 != placeholderResId && 0 != errorResId) {
return taget
.placeholder(placeholderResId)
.error(errorResId);
} else if (0 != placeholderResId) {
return taget.placeholder(placeholderResId);
} else if (0 != errorResId) {
return taget.error(errorResId);
}
return taget;
}
示例6: onPrepareRequestCreator
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
/**
* Prepares loading request creator with configuration based on this task's parameters.
*
* @param loader Loader used to obtain the creator.
* @return Prepared image loading request creator to be executed.
*/
@NonNull
protected RequestCreator onPrepareRequestCreator(@NonNull Picasso loader) {
final RequestCreator creator = loader.load(mTarget);
if (mPlaceholderRes != NO_RESOURCE_ID) creator.error(mPlaceholderRes);
if (mPlaceholder != null) creator.error(mPlaceholder);
if (mErrorRes != NO_RESOURCE_ID) creator.placeholder(mErrorRes);
if (mError != null) creator.placeholder(mError);
if (mTransformation != null) creator.transform(mTransformation);
if (hasRequest(REQUEST_DO_NOT_ANIMATE)) creator.noFade();
return creator;
}
示例7: display
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
public static void display(ImageView imageView, String uri, boolean fadeIn, int stubImage, ImageLoaderListener listener)
{
if (uri == null || uri.length() == 0)
uri = FAKE_URI;
/*uri = uri.replace("�", URLEncoder.encode("�"));
uri = uri.replace("�", URLEncoder.encode("�"));
uri = uri.replace("'", URLEncoder.encode("'"));
uri = uri.replace("�", URLEncoder.encode("�"));*/
uri = Uri.encode(uri, ALLOWED_URI_CHARS);
Picasso picasso = Picasso.with(imageView.getContext());
RequestCreator requestCreator = picasso.load(uri);
if (stubImage != 0)
{
requestCreator.placeholder(stubImage);
requestCreator.error(stubImage);
}
if (!(fadeIn && FADE_ENABLED))
requestCreator.noFade();
LayoutParams params = imageView.getLayoutParams();
if (params.width > 0 && params.height > 0)
{
requestCreator.resize(params.width, params.height, true);
}
requestCreator.inSampleSize(true);
requestCreator.into(imageView, listener);
}
示例8: setUpPhotoFromUrl
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private void setUpPhotoFromUrl(){
RequestCreator requestCreator = Picasso.with(this)
.load(pictureUrl);
if(!showLoadingProgress){
hideProgressView();
}
if(displayErrorDrawableNeeded()){
requestCreator.error(photoErrorDrawableResId);
}
if(displayPlaceHolderNeeded()){
requestCreator.placeholder(photoPlaceHolderResId);
}
requestCreator
.into(picturePhotoView, new Callback() {
@Override
public void onSuccess() {
hideProgressView();
addPhotoViewAttacherAndTapListener();
runHideActionBarTimer();
}
@Override
public void onError() {
hideProgressView();
}
});
}
示例9: build
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private RequestCreator build() {
RequestCreator requestCreator;
if (!TextUtils.isEmpty(url)) {
requestCreator = picasso.load(url);
} else if (resourceId != 0) {
requestCreator = picasso.load(resourceId);
} else {
return null;
}
if (placeholder != null) {
requestCreator = requestCreator.placeholder(placeholder);
}
if (error != null) {
requestCreator = requestCreator.error(error);
}
if (width > 0 && height > 0) {
requestCreator = requestCreator.resize(width, height);
}
if (bitmapTransformation != null) {
for (int i = 0; i < bitmapTransformation.size(); i++) {
requestCreator = requestCreator.transform(bitmapTransformation.get(i));
}
}
if (centerCrop) {
requestCreator = requestCreator.centerCrop();
}
if (fitCenter) {
requestCreator = requestCreator.centerInside();
}
if (degrees > 0) {
requestCreator = requestCreator.rotate(degrees);
}
return requestCreator;
}
开发者ID:Gigigo-Android-Devs,项目名称:gigigo-imageLoader-library-android,代码行数:43,代码来源:ImageLoaderBuilderImp.java
示例10: bindEventAndShow
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private void bindEventAndShow(
@NonNull final ImageView targetImageView,
@NonNull final String mURI
) {
// mLoadListener.onStart(me);
final Picasso p = Picasso.with(mContext);
final RequestCreator mreq = p.load(mURI);
if (getEmpty() != 0) {
mreq.placeholder(getEmpty());
}
if (getError() != 0) {
mreq.error(getError());
}
if (mImageLocalStorageEnable) {
mreq.memoryPolicy(MemoryPolicy.NO_STORE, MemoryPolicy.NO_CACHE);
}
switch (mScaleType) {
case Fit:
mreq.fit();
break;
case CenterCrop:
mreq.fit().centerCrop();
break;
case CenterInside:
mreq.fit().centerInside();
break;
}
mreq.into(targetImageView, new Callback() {
@Override
public void onSuccess() {
// if (v.findViewById(R.id.ns_loading_progress) != null) {
// hideoutView(v.findViewById(R.id.ns_loading_progress));
// }
if (mLongClickSaveImage && fmg != null) {
targetImageView.setOnLongClickListener(new View.OnLongClickListener() {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public boolean onLongClick(View v) {
prepare_request_save_image = mreq;
final saveImageDialog saveImageDial = new saveImageDialog();
saveImageDial.show(fmg.get(), "DESC_SAVE_IM");
return false;
}
});
}
}
@Override
public void onError() {
//if (mLoadListener != null) {
// mLoadListener.onEnd(false, me);
// }
}
});
}
示例11: bindCompatPicasso
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
protected void bindCompatPicasso(String mURI, final MiniSliderFrame Fr) {
final Picasso p = Picasso.with(mContext);
final RequestCreator mreq = p.load(mURI);
if (getEmpty() != 0) {
mreq.placeholder(getEmpty());
}
if (getError() != 0) {
mreq.error(getError());
}
if (mImageLocalStorageEnable) {
mreq.memoryPolicy(MemoryPolicy.NO_STORE, MemoryPolicy.NO_CACHE);
}
switch (mScaleType) {
case Fit:
mreq.fit();
break;
case CenterCrop:
mreq.fit().centerCrop();
break;
case CenterInside:
mreq.fit().centerInside();
break;
}
mreq.into(Fr.getImageTarget(), new Callback() {
@Override
public void onSuccess() {
hideoutView(Fr.getLoadingBar());
if (mLongClickSaveImage && fmg != null) {
Fr.getTouch().setOnLongClickListener(new View.OnLongClickListener() {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public boolean onLongClick(View v) {
prepare_request_save_image = mreq;
final saveImageDialog saveImageDial = new saveImageDialog();
saveImageDial.show(fmg.get(), "DESC_SAVE_IM");
return false;
}
});
}
}
@Override
public void onError() {
//if (mLoadListener != null) {
// mLoadListener.onEnd(false, me);
// }
}
});
}
示例12: loadByPicasso
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
protected void loadByPicasso(final View v, ImageView targetImageView) {
final BaseSliderView me = this;
Picasso p = Picasso.with(mContext);
RequestCreator rq;
if (mUrl != null) {
rq = p.load(mUrl);
} else if (mFile != null) {
rq = p.load(mFile);
} else if (mRes != 0) {
rq = p.load(mRes);
} else {
return;
}
if (rq == null) {
return;
}
if (getImageResForEmpty() != 0) {
rq.placeholder(getImageResForEmpty());
}
if (getImageResForError() != 0) {
rq.error(getImageResForError());
}
switch (mScaleType) {
case Fit:
rq.fit();
break;
case CenterCrop:
rq.fit().centerCrop();
break;
case CenterInside:
rq.fit().centerInside();
break;
}
rq.into(targetImageView, new Callback() {
@Override
public void onSuccess() {
if (v.findViewById(R.id.loading_bar) != null) {
v.findViewById(R.id.loading_bar).setVisibility(View.INVISIBLE);
}
if (mBitmapLoadListener != null) {
mBitmapLoadListener.onLoadComplete(me);
}
}
@Override
public void onError() {
if (mBitmapLoadListener != null) {
mBitmapLoadListener.onLoadFail(me);
}
}
});
}