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


Java Transformation类代码示例

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


Transformation类属于com.squareup.picasso包,在下文中一共展示了Transformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPauseImageFromUrl

import com.squareup.picasso.Transformation; //导入依赖的package包/类
private void setPauseImageFromUrl() {
	Picasso.with(this).load(pauseADInfo.getAd().get(0).getMaterial())
			.skipMemoryCache().transform(new Transformation() {

				@Override
				public Bitmap transform(Bitmap arg0) {
					pauseHeight = arg0.getHeight();
					pauseWidth = arg0.getWidth();
					PlayerUtil.resizeAdView(ADMediaPlayActivity.this, wm, ivPauseView, pauseWidth, pauseHeight);
					return arg0;
				}

				@Override
				public String key() {
					return "pause";
				}
			}).into(ivPauseView);
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:19,代码来源:ADMediaPlayActivity.java

示例2: setFrontImageFromUrl

import com.squareup.picasso.Transformation; //导入依赖的package包/类
private void setFrontImageFromUrl() {
	Picasso.with(this).load(frontADInfo.getAd().get(0).getMaterial())
			.skipMemoryCache().transform(new Transformation() {
				@Override
				public Bitmap transform(Bitmap arg0) {
					frontHeight = arg0.getHeight();
					frontWidth = arg0.getWidth();
					PlayerUtil.resizeAdView(ADMediaPlayActivity.this, wm, ivAd, frontWidth, frontHeight);
					return arg0;
				}

				@Override
				public String key() {
					return "front";
				}
			}).into(ivAd);
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:18,代码来源:ADMediaPlayActivity.java

示例3: loadRoundedImage

import com.squareup.picasso.Transformation; //导入依赖的package包/类
public static Bitmap loadRoundedImage(Context context, String url, @DrawableRes int ifErrorOrEmpty) {
    final Context app = context.getApplicationContext();
    Transformation transformation = CurrentTheme.createTransformationForAvatar(app);

    int size = (int) Utils.dpToPx(64, app);

    if(nonEmpty(url)){
        try {
            return PicassoInstance.with()
                    .load(url)
                    .resize(size, size)
                    .centerCrop()
                    .transform(transformation)
                    .config(Bitmap.Config.RGB_565)
                    .get();
        } catch (IOException e) {
            return loadRoundedImageFromResources(app, ifErrorOrEmpty, transformation, size);
        }
    } else {
        return loadRoundedImageFromResources(app, ifErrorOrEmpty, transformation, size);
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:23,代码来源:NotificationUtils.java

示例4: refreshHeader

import com.squareup.picasso.Transformation; //导入依赖的package包/类
private void refreshHeader(User user) {
    if (!isAdded()) return;

    String avaUrl = user.getMaxSquareAvatar();
    String fullName = user.getFullName();

    Transformation transformation = new RoundTransformation();
    if (nonNull(avaUrl) && !avaUrl.contains("camera")) {
        PicassoInstance.with()
                .load(avaUrl)
                .transform(transformation)
                .into(ivHeaderAvatar);
    } else {
        PicassoInstance.with()
                .load(user.getSex() == Sex.WOMAN ? R.drawable.ic_sex_woman : R.drawable.ic_sex_man)
                .transform(transformation)
                .into(ivHeaderAvatar);
    }

    tvUserName.setText(fullName);

    if (tvDomain != null) {
        String domailText = "@" + user.getDomain();
        tvDomain.setText(domailText);
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:27,代码来源:NavigationFragment.java

示例5: displayAvatar

import com.squareup.picasso.Transformation; //导入依赖的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

示例6: createBitmap

import com.squareup.picasso.Transformation; //导入依赖的package包/类
private static Bitmap createBitmap(Context mContext, String url) throws IOException {
    int appIconSize = getLauncherIconSize(mContext);
    Bitmap bm;

    Transformation transformation = new RoundTransformation();

    if (isEmpty(url)) {
        bm = PicassoInstance.with()
                .load(R.drawable.ic_avatar_unknown)
                .transform(transformation)
                .resize(appIconSize, appIconSize)
                .get();
    } else {
        bm = PicassoInstance.with()
                .load(url)
                .transform(transformation)
                .resize(appIconSize, appIconSize)
                .get();
    }

    return bm;
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:23,代码来源:ShortcutUtils.java

示例7: build

import com.squareup.picasso.Transformation; //导入依赖的package包/类
public Transformation build() {
    return new Transformation() {
        public Bitmap transform(Bitmap source) {
            Bitmap transformed = RoundedDrawable.fromBitmap(source).setScaleType
                    (RoundedTransformationBuilder.this.mScaleType).setCornerRadius
                    (RoundedTransformationBuilder.this.mCornerRadii[0],
                            RoundedTransformationBuilder.this.mCornerRadii[1],
                            RoundedTransformationBuilder.this.mCornerRadii[2],
                            RoundedTransformationBuilder.this.mCornerRadii[3]).setBorderWidth
                    (RoundedTransformationBuilder.this.mBorderWidth).setBorderColor
                    (RoundedTransformationBuilder.this.mBorderColor).setOval
                    (RoundedTransformationBuilder.this.mOval).toBitmap();
            if (!source.equals(transformed)) {
                source.recycle();
            }
            return transformed;
        }

        public String key() {
            return "r:" + Arrays.toString(RoundedTransformationBuilder.this.mCornerRadii) +
                    "b:" + RoundedTransformationBuilder.this.mBorderWidth + "c:" +
                    RoundedTransformationBuilder.this.mBorderColor + "o:" + RoundedTransformationBuilder.this.mOval;
        }
    };
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:RoundedTransformationBuilder.java

示例8: build

import com.squareup.picasso.Transformation; //导入依赖的package包/类
/**
 * Creates a {@link Transformation} for use with picasso.
 *
 * @return the {@link Transformation}
 */
public Transformation build() {
  return new Transformation() {
    @Override public Bitmap transform(Bitmap source) {
      Bitmap transformed = RoundedDrawable.fromBitmap(source)
          .setScaleType(mScaleType)
          .setCornerRadius(mCornerRadii[0], mCornerRadii[1], mCornerRadii[2], mCornerRadii[3])
          .setBorderWidth(mBorderWidth)
          .setBorderColor(mBorderColor)
          .setOval(mOval)
          .toBitmap();
      if (!source.equals(transformed)) {
        source.recycle();
      }
      return transformed;
    }

    @Override public String key() {
      return "r:" + Arrays.toString(mCornerRadii)
          + "b:" + mBorderWidth
          + "c:" + mBorderColor
          + "o:" + mOval;
    }
  };
}
 
开发者ID:weimin96,项目名称:shareNote,代码行数:30,代码来源:RoundedTransformationBuilder.java

示例9: loadLoadingUrl

import com.squareup.picasso.Transformation; //导入依赖的package包/类
private void loadLoadingUrl(@NonNull final String url, @NonNull final String loadingUrl, final boolean loadingBlur) {
    final List<Transformation> transformations = new ArrayList<>();

    if (loadingBlur) {
        transformations.add(new BlurTransformation(getContext()));
    }

    Picasso.with(getContext()).load(loadingUrl).transform(transformations).into(new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            loadUrl(url, bitmap);
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {

        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {

        }
    });
}
 
开发者ID:dmallcott,项目名称:DismissibleImageView,代码行数:25,代码来源:FullScreenImageFragment.java

示例10: getTransformation

import com.squareup.picasso.Transformation; //导入依赖的package包/类
private Transformation getTransformation(final String t) {
    return new Transformation() {
        @Override
        public Bitmap transform(Bitmap b) {
            Palette.from(b).generate(new Palette.PaletteAsyncListener() {
                @Override
                public void onGenerated(final Palette palette) {
                    int defaultColor = rootView.getResources().getColor
                            (android.R.color.white);
                    int titleColor = palette.getLightVibrantColor
                            (defaultColor);
                    CollapsingToolbarLayout collapsingToolbar = get(R.id
                            .collapsing_toolbar);
                    collapsingToolbar.setExpandedTitleColor(titleColor);
                }
            });
            return b;
        }

        @Override
        public String key() {
            return t;
        }
    };
}
 
开发者ID:kymjs,项目名称:CoreModule,代码行数:26,代码来源:BlogDetailDelegate.java

示例11: loadBackgroundImage

import com.squareup.picasso.Transformation; //导入依赖的package包/类
private void loadBackgroundImage() {
    if (headerViewImageReference.size() == 0
            || headerViewImageReference.get(currentPageIndex) == null
            || headerViewImageReference.get(currentPageIndex).size() == 0) {
        loadFallBackBackground();
        return;
    }

    if (headerViewImageReference.get(currentPageIndex).size() <= currentImageIndex + 1) {
        currentImageIndex = -1;
    }

    currentImageIndex++;
    final Transformation tintTransformation = new ColorTintingGrayScaleTransformation(getColorByPosition(currentPageIndex));
    picasso.load(headerViewImageReference.get(currentPageIndex).get(currentImageIndex))
            .transform(tintTransformation)
            .into(panningImage);

    transitionsCount = 0;
}
 
开发者ID:timrijckaert,项目名称:NewsStandHeaderView,代码行数:21,代码来源:NewsStandHeaderView.java

示例12: blurTransformation

import com.squareup.picasso.Transformation; //导入依赖的package包/类
@Override
public Transformation blurTransformation(final String fileName) {
    return new Transformation() {

        private Bitmap blurredImage;

        @Override
        public Bitmap transform(Bitmap source) {
            return getBlurredImage(source,
                    fileName, 20);
        }

        @Override
        public String key() {
            return fileName;
        }
    };
}
 
开发者ID:fiveagency,项目名称:android-core,代码行数:19,代码来源:ImageUtilsImpl.java

示例13: build

import com.squareup.picasso.Transformation; //导入依赖的package包/类
public Transformation build() {
    return new Transformation() {
        @Override
        public Bitmap transform(Bitmap source) {
            Bitmap transformed = RoundedDrawable.fromBitmap(source)
                    .setScaleType(mScaleType)
                    .setCornerRadius(mCornerRadius)
                    .setBorderWidth(mBorderWidth)
                    .setBorderColor(mBorderColor)
                    .setOval(mOval)
                    .toBitmap();
            if (!source.equals(transformed)) {
                source.recycle();
            }
            return transformed;
        }

        @Override
        public String key() {
            return "r:" + mCornerRadius
                    + "b:" + mBorderWidth
                    + "c:" + mBorderColor
                    + "o:" + mOval;
        }
    };
}
 
开发者ID:Hotmart-Org,项目名称:zum-android,代码行数:27,代码来源:RoundedTransformationBuilder.java

示例14: getTransformation

import com.squareup.picasso.Transformation; //导入依赖的package包/类
private static Transformation getTransformation(Context context) {
    if (PICASSO_CIRCLE_TRANSFORMATION == null) {
        final int color;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
            color = context.getResources().getColor(R.color.black);
        } else {
            color = context.getColor(R.color.black);
        }
        PICASSO_CIRCLE_TRANSFORMATION = new RoundedTransformationBuilder()
                .borderColor(color)
                .borderWidthDp(2)
                .scaleType(ImageView.ScaleType.CENTER_CROP)
                .oval(true)
                .build();
    }
    return PICASSO_CIRCLE_TRANSFORMATION;
}
 
开发者ID:lecho,项目名称:conference-app,代码行数:18,代码来源:Utils.java

示例15: build

import com.squareup.picasso.Transformation; //导入依赖的package包/类
/**
 * Creates a {@link Transformation} for use with picasso.
 *
 * @return the {@link Transformation}
 */
public Transformation build() {
    return new Transformation() {
        @Override public Bitmap transform(Bitmap source) {
            Bitmap transformed = RoundedDrawable.fromBitmap(source)
                    .setScaleType(mScaleType)
                    .setCornerRadius(mCornerRadii[0], mCornerRadii[1], mCornerRadii[2], mCornerRadii[3])
                    .setBorderWidth(mBorderWidth)
                    .setBorderColor(mBorderColor)
                    .setOval(mOval)
                    .toBitmap();
            if (!source.equals(transformed)) {
                source.recycle();
            }
            return transformed;
        }

        @Override public String key() {
            return "r:" + Arrays.toString(mCornerRadii)
                    + "b:" + mBorderWidth
                    + "c:" + mBorderColor
                    + "o:" + mOval;
        }
    };
}
 
开发者ID:lawloretienne,项目名称:Loop,代码行数:30,代码来源:RoundedTransformationBuilder.java


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