本文整理汇总了Java中com.squareup.picasso.RequestCreator.fit方法的典型用法代码示例。如果您正苦于以下问题:Java RequestCreator.fit方法的具体用法?Java RequestCreator.fit怎么用?Java RequestCreator.fit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.squareup.picasso.RequestCreator
的用法示例。
在下文中一共展示了RequestCreator.fit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@Override
public void show() {
RequestCreator creator = Picasso.with(imageView != null ? imageView.getContext() : context)
.load(url);
if (transformation != null) {
creator.transform(transformation);
}
if (placeholder != null) {
creator.placeholder(placeholder);
}
if (with > 0 && height > 0) {
creator.resize(with, height);
}
if (centerCrop) {
creator.centerCrop();
}
if (fit) {
creator.fit();
}
if (target != null) {
creator.into(target);
} else {
creator.into(imageView);
}
}
示例2: 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);
// }
}
});
}
示例3: 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);
// }
}
});
}
示例4: 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);
}
}
});
}
示例5: loadThumbnailForAssetWithSize
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
/**
* Loads a thumbnail of an Asset to a given ImageView.
* If explicit dimensions are specified ({@code width} and {@code height}) those will be
* passed as URL parameters to allow server-side scaling of the image.
*/
public static void loadThumbnailForAssetWithSize(Context context, CDAAsset asset,
ImageView imageView, @Nullable Integer width, @Nullable Integer height,
boolean centerCropRemoteImages) {
Integer thumbnailResId = Utils.getThumbnailResIdForAsset(asset);
RequestCreator rc;
Picasso picasso = Picasso.with(context);
boolean hasExplicitDimensions = width != null && height != null;
if (thumbnailResId == null) {
String url = "http:" + asset.url();
if (hasExplicitDimensions) {
if (url.contains("?")) {
url += "&";
} else {
url += "?";
}
url += "w=" + width + "&h=" + height;
}
rc = picasso.load(url);
if (hasExplicitDimensions) {
rc.resize(width, height);
} else {
rc.fit();
}
if (centerCropRemoteImages) {
rc.centerCrop();
} else {
rc.centerInside();
}
} else {
rc = picasso.load(thumbnailResId).fit().centerCrop();
}
rc.into(imageView);
}