当前位置: 首页>>代码示例>>Java>>正文


Java RequestCreator.transform方法代码示例

本文整理汇总了Java中com.squareup.picasso.RequestCreator.transform方法的典型用法代码示例。如果您正苦于以下问题:Java RequestCreator.transform方法的具体用法?Java RequestCreator.transform怎么用?Java RequestCreator.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.squareup.picasso.RequestCreator的用法示例。


在下文中一共展示了RequestCreator.transform方法的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);
            }
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:BoxingPicassoLoader.java

示例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);
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:22,代码来源:ViewUtils.java

示例3: 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;
}
 
开发者ID:AweiLoveAndroid,项目名称:ImageLoaderProcessor,代码行数:27,代码来源:PicassoLoaderProcessor.java

示例4: fetchBitmap

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
private @Nullable Bitmap fetchBitmap(final @Nullable String url, final boolean transformIntoCircle) {
  if (url == null) {
    return null;
  }

  try {
    RequestCreator requestCreator = Picasso.with(this.context).load(url).transform(new CropSquareTransformation());
    if (transformIntoCircle) {
      requestCreator = requestCreator.transform(new CircleTransformation());
    }
    return requestCreator.get();
  } catch (IOException e) {
    Timber.e("Failed to load large icon: %s",  e);
    return null;
  }
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:17,代码来源:PushNotifications.java

示例5: 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);
    }
}
 
开发者ID:EuphoriaDev,项目名称:euphoria-vk-client,代码行数:19,代码来源:MessageHistoryActivity.java

示例6: 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);
}
 
开发者ID:EuphoriaDev,项目名称:euphoria-vk-client,代码行数:17,代码来源:BasicActivity.java

示例7: 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);
            }
        }
    }

}
 
开发者ID:tamzi,项目名称:sophia,代码行数:24,代码来源:MovingImageView.java

示例8: 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);
}
 
开发者ID:jerrellmardis,项目名称:Amphitheatre,代码行数:20,代码来源:BrowseFragment.java

示例9: getPicassoCorned

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
public static RequestCreator getPicassoCorned(RequestCreator request) {
    final int radius = 5;
    final int margin = 5;
    final Transformation transformation = new RoundedCornersTransformation(radius, margin);
    request.transform(transformation);
    return request;
}
 
开发者ID:pvarry,项目名称:intra42,代码行数:8,代码来源:UserImage.java

示例10: loadBitmap

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
/**
 * Loads the bitmap at the provided url, but checks the cache first.
 *
 * @param view the view to where the bitmap shall be set.
 * @param url the urk of the bitmap. This acts as a key for the cache.
 * @param options the option bundle.
 * @param callback an optional callback.
 */
public static void loadBitmap(@NonNull ImageView view, @Nullable String url,
                              @NonNull Options options,
                              @Nullable final Callback callback){
    if (url == null || url.isEmpty()){
        //view.setImageResource(R.drawable.ic_compass_white_50dp);
    }
    else{
        Picasso picasso = Picasso.with(view.getContext());
        picasso.setIndicatorsEnabled(BuildConfig.DEBUG);
        RequestCreator request = picasso.load(url);
        if (options.mUseDefaultPlaceholder){
            //request.placeholder(R.drawable.ic_compass_white_50dp);
        }
        else if (options.mPlaceholder != 0){
            request.placeholder(options.mPlaceholder);
        }
        if (options.mCropToCircle){
            request.transform(new CircleCropTransformation());
        }
        request.into(view, new com.squareup.picasso.Callback(){
            @Override
            public void onSuccess(){
                if (callback != null){
                    callback.onImageLoadSuccess();
                }
            }

            @Override
            public void onError(){
                if (callback != null){
                    callback.onImageLoadFailure();
                }
            }
        });
    }
}
 
开发者ID:tndatacommons,项目名称:OfficeHours-Android,代码行数:45,代码来源:ImageLoader.java

示例11: 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);
  }
}
 
开发者ID:tonilopezmr,项目名称:Game-of-Thrones,代码行数:32,代码来源:PicassoImageLoader.java

示例12: 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;
}
 
开发者ID:albedinsky,项目名称:android_image_loader,代码行数:18,代码来源:ImageTask.java

示例13: loadAndWrite

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
/**
 * Get a picasso request creator with a post disk cache write using picasso transformation.
 *
 * @param sourcePath Source file path to original image.
 * @param fileKey    Source file key.
 * @param config     Bitmap config to use.
 * @return Request creator with a post disk cache write.
 */
public RequestCreator loadAndWrite(String sourcePath, String fileKey, Config config) {
    RequestCreator loader = SinglePicasso.getPicasso().load(new File(sourcePath)).config(config);
    if (sIsInitialized) {
        CacheTransformation writeTransform = new CacheTransformation(fileKey);
        writeTransform.enableDiskWrite(mDiskCache);
        loader.transform(writeTransform);
    }
    return loader;
}
 
开发者ID:InsideGH,项目名称:DiskPicasso,代码行数:18,代码来源:DiskPicasso.java

示例14: refresh

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
public void refresh() {
    if (activeUrl >= 0 && activeImageView != null) {
        RequestCreator rq = Picasso.with(getContext()).load(urls.get(activeUrl));
        if (blur)
            rq = rq.transform(new BlurTransformation());
        rq.into(activeImageView);
    }
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:9,代码来源:MovingImageView.java

示例15: onSuccess

import com.squareup.picasso.RequestCreator; //导入方法依赖的package包/类
@Override
public void onSuccess(int statusCode, Header[] headers, String responseString) {
    Document doc = Jsoup.parse(responseString);

    String avatar;
    if (getAvatar(doc) != null) {
        avatar = getAvatar(doc);
    } else {
        mFailureDialog.setTitle(R.string.this_work_was_deleted);
        mFailureDialog.show();
        return;
    }
    String title = getTitle(doc);
    String author = getAuthor(doc);

    mCollapsingToolbar.setTitle(TextUtils.isEmpty(title) ? getString(R.string.no_titile) : title);
    tvAuthor.setText(author);

    RequestCreator creator = Picasso.with(BaseDetailActivity.this).load(avatar);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        creator.transform(new Transformation() {
            @Override
            public Bitmap transform(Bitmap source) {
                Bitmap bitmap = source.copy(Bitmap.Config.ARGB_8888, true);
                source.recycle();
                return FastBlur.doBlur(bitmap, 2, true);
            }

            @Override
            public String key() {
                return "doBlur";
            }
        });
    }
    creator.into(mBackdrop);

    updateData(doc);
}
 
开发者ID:SamuelGjk,项目名称:BPic,代码行数:39,代码来源:BaseDetailActivity.java


注:本文中的com.squareup.picasso.RequestCreator.transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。