Java Code Examples for com.facebook.drawee.drawable.ScalingUtils#ScaleType

The following examples show how to use com.facebook.drawee.drawable.ScalingUtils#ScaleType . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FrescoViewStateSaver.java    From YcShareElement with Apache License 2.0 6 votes vote down vote up
private ScalingUtils.ScaleType intToScaleType(int index) {
    switch (index) {
        case 0:
            return ScalingUtils.ScaleType.CENTER_CROP;
        case 1:
            return ScalingUtils.ScaleType.CENTER;
        case 2:
            return ScalingUtils.ScaleType.CENTER_INSIDE;
        case 3:
            return ScalingUtils.ScaleType.FIT_CENTER;
        case 4:
            return ScalingUtils.ScaleType.FIT_END;
        case 5:
            return ScalingUtils.ScaleType.FIT_START;
        case 6:
            return ScalingUtils.ScaleType.FIT_XY;
        case 7:
            return ScalingUtils.ScaleType.FOCUS_CROP;
        default:
            return ScalingUtils.ScaleType.CENTER;
    }
}
 
Example 2
Source File: GenericDraweeHierarchy.java    From fresco with MIT License 5 votes vote down vote up
@Nullable
private Drawable buildActualImageBranch(
    Drawable drawable,
    @Nullable ScalingUtils.ScaleType scaleType,
    @Nullable PointF focusPoint,
    @Nullable ColorFilter colorFilter) {
  drawable.setColorFilter(colorFilter);
  drawable = WrappingUtils.maybeWrapWithScaleType(drawable, scaleType, focusPoint);
  return drawable;
}
 
Example 3
Source File: DebugControllerOverlayDrawableTestHelper.java    From fresco with MIT License 5 votes vote down vote up
public void assertOverlayColorOk(
    int imageWidth,
    int imageHeight,
    int drawableWidth,
    int drawableHeight,
    ScalingUtils.ScaleType scaleType) {
  mOverlayDrawable.setBounds(0, 0, drawableWidth, drawableHeight);
  assertEquals(
      DebugControllerOverlayDrawable.TEXT_COLOR_IMAGE_OK,
      mOverlayDrawable.determineSizeHintColor(imageWidth, imageHeight, scaleType));
}
 
Example 4
Source File: GenericDraweeHierarchy.java    From fresco with MIT License 4 votes vote down vote up
/** Sets a new progress bar drawable with scale type. */
public void setProgressBarImage(Drawable drawable, ScalingUtils.ScaleType scaleType) {
  setChildDrawableAtIndex(PROGRESS_BAR_IMAGE_INDEX, drawable);
  getScaleTypeDrawableAtIndex(PROGRESS_BAR_IMAGE_INDEX).setScaleType(scaleType);
}
 
Example 5
Source File: FrescoViewStateSaver.java    From YcShareElement with Apache License 2.0 4 votes vote down vote up
public ScalingUtils.ScaleType getScaleType(Bundle bundle) {
    int scaleType = bundle.getInt("scaleType", 0);
    return intToScaleType(scaleType);
}
 
Example 6
Source File: ImageOptions.java    From fresco with MIT License 4 votes vote down vote up
public @Nullable ScalingUtils.ScaleType getPlaceholderScaleType() {
  return mPlaceholderScaleType;
}
 
Example 7
Source File: GenericDraweeHierarchy.java    From fresco with MIT License 4 votes vote down vote up
/** Sets the actual image scale type. */
public void setActualImageScaleType(ScalingUtils.ScaleType scaleType) {
  Preconditions.checkNotNull(scaleType);
  getScaleTypeDrawableAtIndex(ACTUAL_IMAGE_INDEX).setScaleType(scaleType);
}
 
Example 8
Source File: SimpleScaleTypeAdapter.java    From fresco with MIT License 4 votes vote down vote up
private Entry(
    ScalingUtils.ScaleType scaleType, String description, @Nullable PointF focusPoint) {
  this.scaleType = scaleType;
  this.description = description;
  this.focusPoint = focusPoint;
}
 
Example 9
Source File: DraweeTransition.java    From fresco with MIT License 4 votes vote down vote up
public static TransitionSet createTransitionSet(
    ScalingUtils.ScaleType fromScale, ScalingUtils.ScaleType toScale) {
  return createTransitionSet(fromScale, toScale, null, null);
}
 
Example 10
Source File: FrescoController.java    From base-module with Apache License 2.0 4 votes vote down vote up
public ImageConfigStep retryScaleType(ScalingUtils.ScaleType scaleType) {
    mImageConfig.retryScaleType = scaleType;
    return this;
}
 
Example 11
Source File: FrescoController.java    From base-module with Apache License 2.0 4 votes vote down vote up
public ImageConfigStep failureScaleType(ScalingUtils.ScaleType scaleType) {
    mImageConfig.failureScaleType = scaleType;
    return this;
}
 
Example 12
Source File: GenericDraweeHierarchyBuilder.java    From fresco with MIT License 4 votes vote down vote up
/** Gets the progress bar image scale type. */
public @Nullable ScalingUtils.ScaleType getProgressBarImageScaleType() {
  return mProgressBarImageScaleType;
}
 
Example 13
Source File: GenericDraweeHierarchyBuilder.java    From fresco with MIT License 3 votes vote down vote up
/**
 * Sets the scale type for the actual image.
 *
 * <p>If not set, the default value CENTER_CROP will be used.
 *
 * @param actualImageScaleType scale type for the actual image
 * @return modified instance of this builder
 */
public GenericDraweeHierarchyBuilder setActualImageScaleType(
    @Nullable ScalingUtils.ScaleType actualImageScaleType) {
  mActualImageScaleType = actualImageScaleType;
  mActualImageMatrix = null;
  return this;
}
 
Example 14
Source File: GenericDraweeHierarchyBuilder.java    From fresco with MIT License 3 votes vote down vote up
/**
 * Sets the failure image and its scale type.
 *
 * @param failureDrawable drawable to be used as failure image
 * @param failureImageScaleType scale type for the failure image
 * @return modified instance of this builder
 */
public GenericDraweeHierarchyBuilder setFailureImage(
    Drawable failureDrawable, @Nullable ScalingUtils.ScaleType failureImageScaleType) {
  mFailureImage = failureDrawable;
  mFailureImageScaleType = failureImageScaleType;
  return this;
}
 
Example 15
Source File: GenericDraweeHierarchyBuilder.java    From fresco with MIT License 2 votes vote down vote up
/**
 * Sets the retry image scale type.
 *
 * <p>If not set, the default value CENTER_INSIDE will be used.
 *
 * @param retryImageScaleType scale type for the retry image
 * @return modified instance of this builder
 */
public GenericDraweeHierarchyBuilder setRetryImageScaleType(
    @Nullable ScalingUtils.ScaleType retryImageScaleType) {
  mRetryImageScaleType = retryImageScaleType;
  return this;
}
 
Example 16
Source File: GenericDraweeHierarchyBuilder.java    From fresco with MIT License 2 votes vote down vote up
/**
 * Sets the progress bar image scale type.
 *
 * <p>If not set, the default value CENTER_INSIDE will be used.
 *
 * @param progressBarImageScaleType scale type for the progress bar image
 * @return modified instance of this builder
 */
public GenericDraweeHierarchyBuilder setProgressBarImageScaleType(
    @Nullable ScalingUtils.ScaleType progressBarImageScaleType) {
  mProgressBarImageScaleType = progressBarImageScaleType;
  return this;
}
 
Example 17
Source File: GenericDraweeHierarchyBuilder.java    From fresco with MIT License 2 votes vote down vote up
/**
 * Sets the placeholder image scale type.
 *
 * <p>If not set, the default value CENTER_INSIDE will be used.
 *
 * @param placeholderImageScaleType scale type for the placeholder image
 * @return modified instance of this builder
 */
public GenericDraweeHierarchyBuilder setPlaceholderImageScaleType(
    @Nullable ScalingUtils.ScaleType placeholderImageScaleType) {
  mPlaceholderImageScaleType = placeholderImageScaleType;
  return this;
}
 
Example 18
Source File: GenericDraweeHierarchy.java    From fresco with MIT License 2 votes vote down vote up
/**
 * Sets a new progress bar drawable with scale type.
 *
 * @param resourceId an identifier of an Android drawable or color resource.
 * @param ScalingUtils.ScaleType a new scale type.
 */
public void setProgressBarImage(int resourceId, ScalingUtils.ScaleType scaleType) {
  setProgressBarImage(mResources.getDrawable(resourceId), scaleType);
}
 
Example 19
Source File: GenericDraweeHierarchy.java    From fresco with MIT License 2 votes vote down vote up
/**
 * Sets a new placeholder drawable with scale type.
 *
 * @param resourceId an identifier of an Android drawable or color resource.
 * @param ScalingUtils.ScaleType a new scale type.
 */
public void setPlaceholderImage(int resourceId, ScalingUtils.ScaleType scaleType) {
  setPlaceholderImage(mResources.getDrawable(resourceId), scaleType);
}
 
Example 20
Source File: ImageLoaderUtil.java    From JD-Test with Apache License 2.0 2 votes vote down vote up
/**
 * 设置显示图片缩放类型
 * @param scaleType facebook包下ScalingUtils.ScaleType
 * @return this
 */
public ImageLoaderUtil setActualImageScaleType(ScalingUtils.ScaleType scaleType){
    hierarchy.setActualImageScaleType(scaleType);
    return this;
}