本文整理汇总了Java中com.facebook.drawee.generic.GenericDraweeHierarchy.setActualImageScaleType方法的典型用法代码示例。如果您正苦于以下问题:Java GenericDraweeHierarchy.setActualImageScaleType方法的具体用法?Java GenericDraweeHierarchy.setActualImageScaleType怎么用?Java GenericDraweeHierarchy.setActualImageScaleType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.drawee.generic.GenericDraweeHierarchy
的用法示例。
在下文中一共展示了GenericDraweeHierarchy.setActualImageScaleType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeDraweeViewScaleType
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
private void changeDraweeViewScaleType(
SimpleDraweeView draweeView,
ScaleType scaleType,
@Nullable PointF focusPoint) {
final GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
hierarchy.setActualImageScaleType(scaleType);
hierarchy.setActualImageFocusPoint(focusPoint != null ? focusPoint : new PointF(0.5f, 0.5f));
final RoundingParams roundingParams = Preconditions.checkNotNull(hierarchy.getRoundingParams());
if (BITMAP_ONLY_SCALETYPES.contains(scaleType)) {
roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
} else {
roundingParams.setOverlayColor(mWindowBackgroundColor);
}
hierarchy.setRoundingParams(roundingParams);
}
示例2: frescoViewSetScaleType
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
private void frescoViewSetScaleType(Context context, SimpleDraweeView mFrescoView){
GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(context.getResources());
GenericDraweeHierarchy hierarchy = builder.build();
mFrescoView.setHierarchy(hierarchy);
switch (mScaleType) {
case FIT_XY:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_XY);
break;
case FIT_START:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_START);
break;
case FIT_CENTER:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
break;
case FIT_END:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_END);
break;
case CENTER:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER);
break;
case CENTER_CROP:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
break;
case CENTER_INSIDE:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_INSIDE);
break;
}
}
示例3: setImage
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
public static void setImage(@NonNull SimpleDraweeView simpleDraweeView, String lowResUrl,
@NonNull String highResUrl) {
GenericDraweeHierarchy hierarchy = simpleDraweeView.getHierarchy();
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setLowResImageRequest(ImageRequest.fromUri(lowResUrl))
.setImageRequest(ImageRequest.fromUri(highResUrl))
.setOldController(simpleDraweeView.getController())
.build();
simpleDraweeView.setController(controller);
}
示例4: initImage
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
private void initImage() {
PipelineDraweeControllerBuilder controller = FrescoUtils.getPreController(url, pdvImage);
controller.setControllerListener(listener);
final GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
.setProgressBarImage(new ImageLoadProgressBar(new ImageLoadProgressBar.OnLevelChangeListener() {
@Override
public void onChange(int level) {
if (level >= 100) {
hideLoadingDialog();
}
}
}, Color.parseColor("#90CCCCCC"))).build();
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
pdvImage.setHierarchy(hierarchy);
pdvImage.setController(controller.build());
pdvImage.setOnPhotoTapListener(new OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
if (mActivity != null)
mActivity.finish();
}
});
pdvImage.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
}
示例5: changeMainDraweeScaleType
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
private void changeMainDraweeScaleType(ScaleType scaleType, @Nullable PointF focusPoint) {
final GenericDraweeHierarchy hierarchy = mDraweeMain.getHierarchy();
hierarchy.setActualImageScaleType(scaleType);
hierarchy.setActualImageFocusPoint(focusPoint != null ? focusPoint : new PointF(0.5f, 0.5f));
}
示例6: setScaleType
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
public void setScaleType(ScalingUtils.ScaleType scaleType) {
GenericDraweeHierarchy hierarchy = getHierarchy();
hierarchy.setActualImageScaleType(scaleType);
setHierarchy(hierarchy);
}
示例7: maybeUpdateView
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
public void maybeUpdateView() {
if (!mIsDirty) {
return;
}
boolean doResize = shouldResize(mUri);
if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
// If need a resize and the size is not yet set, wait until the layout pass provides one
return;
}
GenericDraweeHierarchy hierarchy = getHierarchy();
hierarchy.setActualImageScaleType(mScaleType);
if (mLoadingImageDrawable != null) {
hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
}
boolean usePostprocessorScaling =
mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;
RoundingParams roundingParams = hierarchy.getRoundingParams();
roundingParams.setCornersRadius(hierarchyRadius);
roundingParams.setBorder(mBorderColor, mBorderWidth);
if (mOverlayColor != Color.TRANSPARENT) {
roundingParams.setOverlayColor(mOverlayColor);
} else {
// make sure the default rounding method is used.
roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
}
hierarchy.setRoundingParams(roundingParams);
hierarchy.setFadeDuration(
mFadeDurationMs >= 0
? mFadeDurationMs
: mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);
Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;
ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
.setPostprocessor(postprocessor)
.setResizeOptions(resizeOptions)
.setAutoRotateEnabled(true)
.setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
.build();
// This builder is reused
mDraweeControllerBuilder.reset();
mDraweeControllerBuilder
.setAutoPlayAnimations(true)
.setCallerContext(mCallerContext)
.setOldController(getController())
.setImageRequest(imageRequest);
if (mControllerListener != null && mControllerForTesting != null) {
ForwardingControllerListener combinedListener = new ForwardingControllerListener();
combinedListener.addListener(mControllerListener);
combinedListener.addListener(mControllerForTesting);
mDraweeControllerBuilder.setControllerListener(combinedListener);
} else if (mControllerForTesting != null) {
mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
} else if (mControllerListener != null) {
mDraweeControllerBuilder.setControllerListener(mControllerListener);
}
setController(mDraweeControllerBuilder.build());
mIsDirty = false;
}
示例8: maybeUpdateView
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
public void maybeUpdateView() {
if (!mIsDirty) {
return;
}
boolean doResize = shouldResize(mUri);
if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
// If need a resize and the size is not yet set, wait until the layout pass provides one
return;
}
GenericDraweeHierarchy hierarchy = getHierarchy();
hierarchy.setActualImageScaleType(mScaleType);
if (mLoadingImageDrawable != null) {
hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
}
boolean usePostprocessorScaling =
mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
RoundingParams roundingParams = hierarchy.getRoundingParams();
if (usePostprocessorScaling) {
roundingParams.setCornersRadius(0);
} else {
cornerRadii(sComputedCornerRadii);
roundingParams.setCornersRadii(sComputedCornerRadii[0], sComputedCornerRadii[1], sComputedCornerRadii[2], sComputedCornerRadii[3]);
}
roundingParams.setBorder(mBorderColor, mBorderWidth);
if (mOverlayColor != Color.TRANSPARENT) {
roundingParams.setOverlayColor(mOverlayColor);
} else {
// make sure the default rounding method is used.
roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
}
hierarchy.setRoundingParams(roundingParams);
hierarchy.setFadeDuration(
mFadeDurationMs >= 0
? mFadeDurationMs
: mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);
Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;
ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
.setPostprocessor(postprocessor)
.setResizeOptions(resizeOptions)
.setAutoRotateEnabled(true)
.setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
.build();
// This builder is reused
mDraweeControllerBuilder.reset();
mDraweeControllerBuilder
.setAutoPlayAnimations(true)
.setCallerContext(mCallerContext)
.setOldController(getController())
.setImageRequest(imageRequest);
if (mControllerListener != null && mControllerForTesting != null) {
ForwardingControllerListener combinedListener = new ForwardingControllerListener();
combinedListener.addListener(mControllerListener);
combinedListener.addListener(mControllerForTesting);
mDraweeControllerBuilder.setControllerListener(combinedListener);
} else if (mControllerForTesting != null) {
mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
} else if (mControllerListener != null) {
mDraweeControllerBuilder.setControllerListener(mControllerListener);
}
setController(mDraweeControllerBuilder.build());
mIsDirty = false;
}
示例9: maybeUpdateView
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
public void maybeUpdateView() {
if (!mIsDirty) {
return;
}
boolean doResize = shouldResize(mUri);
if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
// If need a resize and the size is not yet set, wait until the layout pass provides one
return;
}
GenericDraweeHierarchy hierarchy = getHierarchy();
hierarchy.setActualImageScaleType(mScaleType);
if (mLoadingImageDrawable != null) {
// hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
}
boolean usePostprocessorScaling =
mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;
RoundingParams roundingParams = hierarchy.getRoundingParams();
roundingParams.setCornersRadius(hierarchyRadius);
roundingParams.setBorder(mBorderColor, mBorderWidth);
hierarchy.setRoundingParams(roundingParams);
hierarchy.setFadeDuration(
mFadeDurationMs >= 0
? mFadeDurationMs
: mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);
Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;
Postprocessor redMeshPostprocessor = new redMeshPostprocessor();
ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
.setPostprocessor(redMeshPostprocessor)
.setResizeOptions(resizeOptions)
.setAutoRotateEnabled(true)
.setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
.build();
// This builder is reused
mDraweeControllerBuilder.reset();
mDraweeControllerBuilder
.setAutoPlayAnimations(true)
.setCallerContext(mCallerContext)
.setOldController(getController())
.setImageRequest(imageRequest);
if (mControllerListener != null && mControllerForTesting != null) {
ForwardingControllerListener combinedListener = new ForwardingControllerListener();
combinedListener.addListener(mControllerListener);
combinedListener.addListener(mControllerForTesting);
mDraweeControllerBuilder.setControllerListener(combinedListener);
} else if (mControllerForTesting != null) {
mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
} else if (mControllerListener != null) {
mDraweeControllerBuilder.setControllerListener(mControllerListener);
}
setController(mDraweeControllerBuilder.build());
mIsDirty = false;
}
示例10: maybeUpdateView
import com.facebook.drawee.generic.GenericDraweeHierarchy; //导入方法依赖的package包/类
public void maybeUpdateView() {
if (!mIsDirty) {
return;
}
boolean doResize = shouldResize(mUri);
if (doResize && (getWidth() <= 0 || getHeight() <= 0)) {
// If need a resize and the size is not yet set, wait until the layout pass provides one
return;
}
GenericDraweeHierarchy hierarchy = getHierarchy();
hierarchy.setActualImageScaleType(mScaleType);
if (mLoadingImageDrawable != null) {
hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
}
boolean usePostprocessorScaling =
mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;
RoundingParams roundingParams = hierarchy.getRoundingParams();
roundingParams.setCornersRadius(hierarchyRadius);
roundingParams.setBorder(mBorderColor, mBorderWidth);
if (mOverlayColor != Color.TRANSPARENT) {
roundingParams.setOverlayColor(mOverlayColor);
} else {
// make sure the default rounding method is used.
roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
}
hierarchy.setRoundingParams(roundingParams);
hierarchy.setFadeDuration(
mFadeDurationMs >= 0
? mFadeDurationMs
: mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);
Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;
ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
.setPostprocessor(postprocessor)
.setResizeOptions(resizeOptions)
.setAutoRotateEnabled(true)
.setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
.build();
// This builder is reused
mDraweeControllerBuilder.reset();
mDraweeControllerBuilder
.setAutoPlayAnimations(true)
.setCallerContext(mCallerContext)
.setOldController(getController())
.setImageRequest(imageRequest);
if (mControllerListener != null && mControllerForTesting != null) {
ForwardingControllerListener combinedListener = new ForwardingControllerListener();
combinedListener.addListener(mControllerListener);
combinedListener.addListener(mControllerForTesting);
mDraweeControllerBuilder.setControllerListener(combinedListener);
} else if (mControllerForTesting != null) {
mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
} else if (mControllerListener != null) {
mDraweeControllerBuilder.setControllerListener(mControllerListener);
}
setController(mDraweeControllerBuilder.build());
mIsDirty = false;
}