本文整理汇总了Java中com.squareup.picasso.RequestCreator.into方法的典型用法代码示例。如果您正苦于以下问题:Java RequestCreator.into方法的具体用法?Java RequestCreator.into怎么用?Java RequestCreator.into使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.squareup.picasso.RequestCreator
的用法示例。
在下文中一共展示了RequestCreator.into方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayRaw
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, int width, int height, final IBoxingCallback callback) {
String path = "file://" + absPath;
RequestCreator creator = Picasso.with(img.getContext())
.load(path);
if (width > 0 && height > 0) {
creator.transform(new BitmapTransform(width, height));
}
creator.into(img, new Callback() {
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
@Override
public void onError() {
if (callback != null) {
callback.onFail(null);
}
}
});
}
示例2: displayAvatar
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
public static void displayAvatar(@NonNull ImageView dest, Transformation transformation, String url, String tag, @DrawableRes int ifEmpty) {
Picasso picasso = PicassoInstance.with();
RequestCreator requestCreator;
if (nonEmpty(url)) {
requestCreator = picasso.load(url);
} else {
requestCreator = picasso.load(ifEmpty);
}
if (transformation != null) {
requestCreator.transform(transformation);
}
if (tag != null) {
requestCreator.tag(tag);
}
requestCreator.into(dest);
}
示例3: 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);
}
示例4: getView
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View entry = convertView != null ? convertView : inflater.inflate(R.layout.flair_entry, parent, false);
String id = ids[position];
((TextView) entry.findViewById(R.id.flairText)).setText(id);
ImageView imageView = (ImageView) entry.findViewById(R.id.flair);
Picasso.with(context).cancelRequest(imageView);
RequestCreator request = flairStylesheet.loadFlairById(id, context);
if(request != null) request.into(imageView);
imageView.getLayoutParams().width = (int) (flairStylesheet.prevDimension.width * context.getResources().getDisplayMetrics().density);
imageView.getLayoutParams().height = (int) (flairStylesheet.prevDimension.height * context.getResources().getDisplayMetrics().density);
return entry;
}
示例5: displayImage
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@Override
public void displayImage(Context context, String path, FixImageView imageView, Drawable defaultDrawable, Bitmap.Config config, boolean resize, boolean isGif, int width, int height, int rotate) {
RequestCreator creator = Picasso.with(context)
.load(new File(path))
.placeholder(defaultDrawable)
.error(defaultDrawable)
.rotate(rotate)
.networkPolicy(NetworkPolicy.NO_STORE)
.config(config)
.tag(context);
if (resize) {
creator = creator.resize(width, height)
.centerCrop();
}
creator.into(imageView);
}
示例6: 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);
}
示例7: loadWallpaperFromSD
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private void loadWallpaperFromSD() {
String path = ThemeManager.getWallpaperPath(this);
ImageView ivWallpaper = (ImageView) findViewById(R.id.ivWallpaper);
if (!TextUtils.isEmpty(path)) {
int blurRadius = PrefManager.getInt(SettingsFragment.KEY_BLUR_RADIUS);
boolean applyBlur = PrefManager.getBoolean(SettingsFragment.KEY_BLUR_WALLPAPER);
ivWallpaper.setVisibility(View.VISIBLE);
final RequestCreator creator = Picasso.with(this)
.load(new File(path));
if (applyBlur) {
creator.transform(new AndroidUtils.PicassoBlurTransform(blurRadius));
}
creator.into(ivWallpaper);
} else {
ivWallpaper.setVisibility(View.GONE);
}
}
示例8: loadWallpaper
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private void loadWallpaper() {
String wallpaperPath = ThemeManager.getWallpaperPath(this);
if (TextUtils.isEmpty(wallpaperPath)) {
return;
}
ImageView ivWallpaper = (ImageView) findViewById(R.id.ivWallpaper);
ivWallpaper.setVisibility(View.VISIBLE);
boolean applyBlur = PrefManager.getBoolean(SettingsFragment.KEY_BLUR_WALLPAPER);
RequestCreator creator = Picasso.with(this)
.load(new File(wallpaperPath));
if (applyBlur) {
creator.transform(new AndroidUtils.PicassoBlurTransform(PrefManager.getInt(SettingsFragment.KEY_BLUR_RADIUS)));
}
creator.into(ivWallpaper);
}
示例9: display
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@Override
public void display(Context context, String path, ImageView imageView, Drawable defaultDrawable,
Bitmap.Config config, boolean resize, int width, int height) {
RequestCreator creator = Picasso.with(context)
.load(new File(path))
.placeholder(defaultDrawable)
.error(defaultDrawable)
// .rotate(rotate)
.networkPolicy(NetworkPolicy.NO_STORE)
.config(config)
.tag(context);
if (resize) {
creator = creator.resize(width, height);
}
creator.into(imageView);
}
示例10: displayCenterCrop
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@Override
public void displayCenterCrop(Context context, String path, ImageView imageView, Drawable defaultDrawable,
Bitmap.Config config, boolean resize, int width, int height) {
RequestCreator creator = Picasso.with(context)
.load(new File(path))
.placeholder(defaultDrawable)
.error(defaultDrawable)
// .rotate(rotate)
.networkPolicy(NetworkPolicy.NO_STORE)
.config(config)
.tag(context);
if (resize) {
creator = creator.resize(width, height);
}
creator.centerCrop();
creator.into(imageView);
}
示例11: displayImage
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
public void displayImage(ImageView view, String url) {
if(url == null) {
view.setImageResource(R.mipmap.ic_launcher);
return;
}
else if (TextUtils.isEmpty(url)) {//空图片显示
view.setImageResource(R.mipmap.ic_launcher);
return;
}
RequestCreator creator = imageLoader
.load(url)
.placeholder(R.mipmap.ic_launcher)
.error(R.mipmap.ic_launcher)
.config(Bitmap.Config.RGB_565);//不透明的图片使用减少内存
if (view.getWidth() == 0 && view.getHeight() == 0){
}
else {
creator.centerCrop()
.resize(view.getWidth(), view.getHeight());
}
creator.into(view);
}
示例12: addImageToContent
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@Override
public void addImageToContent(String link) {
final ImageView view = (ImageView) getActivity().getLayoutInflater().inflate(R.layout.article_content_img_item, mContentLayout, false);
mContentLayout.addView(view);
view.setTag(link);
final ImageListener l = new ImageListener(view, link);
view.setOnClickListener(l);
RequestCreator r = Picasso.with(getActivity()).load(link).placeholder(R.drawable.default_content_image_loading);
if (PreferenceHelper.getInstance().inSafeDataMode()) {
l.setLoadCacheForFirst(true);
r.networkPolicy(NetworkPolicy.OFFLINE);
}
r.into(view, l);
}
示例13: swapImage
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
protected void swapImage() {
if (this.urls != null && this.urls.size() > 0) {
super.swapImage();
if (activeImageView != null) {
activeUrl++;
if (activeUrl >= this.urls.size())
activeUrl = 0;
String newUrl = this.urls.get(activeUrl);
if (newUrl != null) {
RequestCreator rq = Picasso.with(getContext()).load(newUrl);
if (blur)
rq = rq.transform(new BlurTransformation());
rq.into(activeImageView);
}
}
}
}
示例14: 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);
}
示例15: updateBackground
import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private void updateBackground(String url) {
SharedPreferences sharedPrefs = PreferenceManager
.getDefaultSharedPreferences(getActivity().getApplicationContext());
RequestCreator requestCreator = Picasso.with(getActivity())
.load(url)
.placeholder(R.drawable.placeholder)
.resize(mMetrics.widthPixels, mMetrics.heightPixels)
.centerCrop()
.skipMemoryCache();
switch(Enums.BlurState.valueOf(sharedPrefs.getString(Constants.BACKGROUND_BLUR, ""))) {
case ON:
requestCreator = requestCreator.transform(mBlurTransformation);
break;
}
requestCreator.into(mBackgroundTarget);
}