當前位置: 首頁>>代碼示例>>Java>>正文


Java ScalingUtils.ScaleType方法代碼示例

本文整理匯總了Java中com.facebook.drawee.drawable.ScalingUtils.ScaleType方法的典型用法代碼示例。如果您正苦於以下問題:Java ScalingUtils.ScaleType方法的具體用法?Java ScalingUtils.ScaleType怎麽用?Java ScalingUtils.ScaleType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.drawee.drawable.ScalingUtils的用法示例。


在下文中一共展示了ScalingUtils.ScaleType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convertToFrescoScaleType

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
private static ScalingUtils.ScaleType convertToFrescoScaleType(ImageView.ScaleType scaleType, ScalingUtils.ScaleType defaultScaleType) {
    switch (scaleType) {
        case CENTER:
            return ScalingUtils.ScaleType.CENTER;
        case CENTER_CROP:
            return ScalingUtils.ScaleType.CENTER_CROP;
        case CENTER_INSIDE:
            return ScalingUtils.ScaleType.CENTER_INSIDE;
        case FIT_CENTER:
            return ScalingUtils.ScaleType.FIT_CENTER;
        case FIT_START:
            return ScalingUtils.ScaleType.FIT_START;
        case FIT_END:
            return ScalingUtils.ScaleType.FIT_END;
        case FIT_XY:
            return ScalingUtils.ScaleType.FIT_XY;
        case MATRIX:
            //NOTE this case
            //you should set FocusPoint to make sentence
            return ScalingUtils.ScaleType.FOCUS_CROP;
        default:
            return defaultScaleType;
    }
}
 
開發者ID:lizhangqu,項目名稱:FrescoLoader,代碼行數:25,代碼來源:FrescoLoader.java

示例2: toScaleType

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
/**
 * Converts JS resize modes into {@code ScalingUtils.ScaleType}.
 * See {@code ImageResizeMode.js}.
 */
public static ScalingUtils.ScaleType toScaleType(@Nullable String resizeModeValue) {
  if ("contain".equals(resizeModeValue)) {
    return ScalingUtils.ScaleType.CENTER_INSIDE;
  }
  if ("cover".equals(resizeModeValue)) {
    return ScalingUtils.ScaleType.CENTER_CROP;
  }
  if ("stretch".equals(resizeModeValue)) {
    return ScalingUtils.ScaleType.FIT_XY;
  }
  if (resizeModeValue == null) {
    // Use the default. Never use null.
    return defaultValue();
  }
  throw new JSApplicationIllegalArgumentException(
      "Invalid resize mode: '" + resizeModeValue + "'");
}
 
開發者ID:john1jan,項目名稱:ReactNativeSignatureExample,代碼行數:22,代碼來源:ImageResizeMode.java

示例3: loadImage

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
public void loadImage(String url,String lowurl, int placeHolderResId, int errorResId,ScalingUtils.ScaleType scaleType){
    final boolean isHttp = url.startsWith("http");
    Uri uri = isHttp ? Uri.parse(url) :  Uri.fromFile(new File(url));
    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
         .setImageRequest(ImageRequest.fromUri(uri));
    if(lowurl!=null &&  lowurl.startsWith("http")) {
        controller .setLowResImageRequest(ImageRequest.fromUri(lowurl));
    }
    getHierarchy().setActualImageScaleType(scaleType);
                    // controller.setUri(URI);
    getHierarchy().setPlaceholderImage(getResources().getDrawable( placeHolderResId ),scaleType);
    getHierarchy().setFailureImage(getResources().getDrawable(errorResId),scaleType);
    controller.setOldController(this.getController())
         .setControllerListener(new BaseControllerListener<ImageInfo>() {
             @Override
             public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
                 if (imageInfo == null) {
                     return;
                 }
                 PhotoDraweeView.this.update(imageInfo.getWidth(), imageInfo.getHeight());
             }
         });
    this.setController(controller.build());
}
 
開發者ID:LightSun,項目名稱:android-photo-picker,代碼行數:25,代碼來源:PhotoDraweeView.java

示例4: toScaleType

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
/**
 * Converts JS resize modes into {@code ScalingUtils.ScaleType}.
 * See {@code ImageResizeMode.js}.
 */
public static ScalingUtils.ScaleType toScaleType(@Nullable String resizeModeValue) {
  if ("contain".equals(resizeModeValue)) {
    return ScalingUtils.ScaleType.FIT_CENTER;
  }
  if ("cover".equals(resizeModeValue)) {
    return ScalingUtils.ScaleType.CENTER_CROP;
  }
  if ("stretch".equals(resizeModeValue)) {
    return ScalingUtils.ScaleType.FIT_XY;
  }
  if ("center".equals(resizeModeValue)) {
    return ScalingUtils.ScaleType.CENTER_INSIDE;
  }
  if (resizeModeValue == null) {
    // Use the default. Never use null.
    return defaultValue();
  }
  throw new JSApplicationIllegalArgumentException(
      "Invalid resize mode: '" + resizeModeValue + "'");
}
 
開發者ID:Right-Men,項目名稱:Ironman,代碼行數:25,代碼來源:ImageResizeMode.java

示例5: createTransitionSet

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
public static TransitionSet createTransitionSet(
    ScalingUtils.ScaleType fromScale,
    ScalingUtils.ScaleType toScale) {
  TransitionSet transitionSet = new TransitionSet();
  transitionSet.addTransition(new ChangeBounds());
  transitionSet.addTransition(new DraweeTransition(fromScale, toScale));
  return transitionSet;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:DraweeTransition.java

示例6: assertOverlayColorOk

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
public void assertOverlayColorOk(
    int imageWidth,
    int imageHeight,
    int drawableWidth,
    int drawableHeight,
    ScalingUtils.ScaleType scaleType) {
  mOverlayDrawable.setBounds(0, 0, drawableWidth, drawableHeight);
  assertEquals(
      DebugControllerOverlayDrawable.OVERLAY_COLOR_IMAGE_OK,
      mOverlayDrawable.determineOverlayColor(
          imageWidth,
          imageHeight,
          scaleType));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:DebugControllerOverlayDrawableTestHelper.java

示例7: assertOverlayColorAlmostOk

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
public void assertOverlayColorAlmostOk(
    int imageWidth,
    int imageHeight,
    int drawableWidth,
    int drawableHeight,
    ScalingUtils.ScaleType scaleType) {
  mOverlayDrawable.setBounds(0, 0, drawableWidth, drawableHeight);
  assertEquals(
      DebugControllerOverlayDrawable.OVERLAY_COLOR_IMAGE_ALMOST_OK,
      mOverlayDrawable.determineOverlayColor(
          imageWidth,
          imageHeight,
          scaleType));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:DebugControllerOverlayDrawableTestHelper.java

示例8: assertOverlayColorNotOk

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
public void assertOverlayColorNotOk(
    int imageWidth,
    int imageHeight,
    int drawableWidth,
    int drawableHeight,
    ScalingUtils.ScaleType scaleType) {
  mOverlayDrawable.setBounds(0, 0, drawableWidth, drawableHeight);
  assertEquals(
      DebugControllerOverlayDrawable.OVERLAY_COLOR_IMAGE_NOT_OK,
      mOverlayDrawable.determineOverlayColor(
          imageWidth,
          imageHeight,
          scaleType));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:DebugControllerOverlayDrawableTestHelper.java

示例9: Entry

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
private Entry(
    ScalingUtils.ScaleType scaleType,
    String description,
    @Nullable PointF focusPoint) {
  this.scaleType = scaleType;
  this.description = description;
  this.focusPoint = focusPoint;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:SimpleScaleTypeAdapter.java

示例10: setDefaultHierarchy

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
public void setDefaultHierarchy(DraweeView draweeView, Drawable defaultDrawable, ScalingUtils.ScaleType defaultScaleType, ScalingUtils.ScaleType targerScaleType, boolean isCircle) {
        GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder( mContext.getResources())
                .setPlaceholderImage(defaultDrawable, defaultScaleType)
                .setFailureImage(defaultDrawable, ScalingUtils.ScaleType.CENTER_CROP)
//				.setProgressBarImage(new ProgressBarDrawable())
                .setActualImageScaleType(targerScaleType)
                .build();
        if ( isCircle ) {
            gdh.setRoundingParams(RoundingParams.asCircle());
        }
        draweeView.setHierarchy(gdh);
    }
 
開發者ID:ebridfighter,項目名稱:GongXianSheng,代碼行數:13,代碼來源:FrecoFactory.java

示例11: disPlay

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
/**
     * 自定義控件調用該方法顯示
     * @param draweeView
     * @param uri
     * @param resizeOptions
     * @param defaultDrawable
     * @param scaleType
     */
    public void disPlay(DraweeView draweeView, Uri uri, String lowResUri, ResizeOptions resizeOptions, Drawable defaultDrawable, ScalingUtils.ScaleType scaleType, ControllerListener controllerListener) {
//        System.out.println(draweeView.hasHierarchy());
        if (!draweeView.hasHierarchy()) {
            setDefaultHierarchy(draweeView,defaultDrawable,scaleType);
        }
        ImageRequestBuilder imageRequestBuilder =
                ImageRequestBuilder.newBuilderWithSource(uri);
        if (UriUtil.isNetworkUri(uri)) {
            imageRequestBuilder.setProgressiveRenderingEnabled(true);
        }
        else {
            imageRequestBuilder.setLocalThumbnailPreviewsEnabled(true);
            imageRequestBuilder.setProgressiveRenderingEnabled(false);
            if ( resizeOptions != null ) {
                imageRequestBuilder.setResizeOptions(resizeOptions);
            }
        }
//        imageRequestBuilder.setAutoRotateEnabled(true);
//        imageRequestBuilder.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH);
        DraweeController draweeController = Fresco.newDraweeControllerBuilder()
                .setImageRequest(imageRequestBuilder.build())
                .setOldController(draweeView.getController())
                .setLowResImageRequest(ImageRequest.fromUri(lowResUri))
                .setControllerListener(controllerListener)
                .build();
        draweeView.setController(draweeController);
    }
 
開發者ID:ebridfighter,項目名稱:GongXianSheng,代碼行數:36,代碼來源:FrecoFactory.java

示例12: loadImage

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
/***
 * load net work image.
 * @param url the main url of image, from net
 * @param lowUrl the low url, from net or local image file name, can be null.
 * @param placeHolder the place holder. 0 with no place holder
 * @param errorResId error res id , 0 with no error res.
 * @param width the width you want
 * @param height the height you want
 * @param scaleType scale type
 * @param l BaseControllerListener,can be null
 */
public void loadImage(String url, String lowUrl,int placeHolder, int errorResId,
                      ScalingUtils.ScaleType scaleType, int width , int height ,
                      final BaseControllerListener<ImageInfo> l){
    ImageRequest request = ImageRequestBuilder
            .newBuilderWithSource(Uri.parse(url))
            //.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH)
            .setResizeOptions(new ResizeOptions(width, height))
            .build();
    getHierarchy().setActualImageScaleType(scaleType);
    if(placeHolder!=0) {
        getHierarchy().setPlaceholderImage(getResources().getDrawable( placeHolder ),scaleType);
    }
    if(errorResId!=0){
        getHierarchy().setFailureImage(getResources().getDrawable( errorResId ),scaleType);
    }
    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
            .setControllerListener(l)
            .setImageRequest(request)
            .setOldController(getController());
    if(lowUrl!=null){
        Uri lowUri = lowUrl.startsWith("http") ? Uri.parse(lowUrl) : Uri.fromFile(new File(lowUrl));
        controller.setLowResImageRequest(ImageRequestBuilder.newBuilderWithSource(lowUri)
                .setResizeOptions(new ResizeOptions(width, height))
                .build() );
    }
    setController(controller.build());
}
 
開發者ID:LightSun,項目名稱:android-photo-picker,代碼行數:39,代碼來源:CommonDraweeView.java

示例13: setShotHierarchy

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
public static final void setShotHierarchy(Context context, DraweeView view, ScalingUtils.ScaleType type, int bg) {
    final Resources res = context.getResources();
    final int color = ThemeUtil.getThemeColor(context, R.attr.colorAccent);
    final ProgressBarDrawable progress = new ProgressBarDrawable();
    progress.setBackgroundColor(Color.parseColor("#33000000"));
    progress.setColor(color);
    GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(res)
            .setPlaceholderImage(res.getDrawable(R.drawable.ic_holder))
            .setProgressBarImage(progress)
            .setBackground(new ColorDrawable(bg))
            .setActualImageScaleType(type)
            .build();
    view.setHierarchy(gdh);
}
 
開發者ID:goodev,項目名稱:materialup,代碼行數:15,代碼來源:FrescoUtils.java

示例14: wrapWithScaleType

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
public static Drawable wrapWithScaleType(
        Drawable drawable,
        @Nullable ScalingUtils.ScaleType scaleType) {
    Preconditions.checkNotNull(drawable);
    if (scaleType == null) {
        return drawable;
    }
    return new ScaleTypeDrawable(drawable, scaleType);
}
 
開發者ID:succlz123,項目名稱:S1-Go,代碼行數:10,代碼來源:ImageLoader.java

示例15: getScaleTypeFromXml

import com.facebook.drawee.drawable.ScalingUtils; //導入方法依賴的package包/類
/**
 * Returns the scale type indicated in XML, or null if the special 'none' value was found.
 */
private static ScalingUtils.ScaleType getScaleTypeFromXml(
        TypedArray attrs,
        int attrId,
        ScalingUtils.ScaleType defaultScaleType) {
  String xmlType = attrs.getString(attrId);
  return (xmlType != null) ? ScalingUtils.ScaleType.fromString(xmlType) : defaultScaleType;
}
 
開發者ID:petropavel13,項目名稱:ZoomableFrescoExample,代碼行數:11,代碼來源:ZoomableDraweeView.java


注:本文中的com.facebook.drawee.drawable.ScalingUtils.ScaleType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。