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


Java GenericDraweeHierarchyBuilder類代碼示例

本文整理匯總了Java中com.facebook.drawee.generic.GenericDraweeHierarchyBuilder的典型用法代碼示例。如果您正苦於以下問題:Java GenericDraweeHierarchyBuilder類的具體用法?Java GenericDraweeHierarchyBuilder怎麽用?Java GenericDraweeHierarchyBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: testMockBuilderOfDrawableHierarchies

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
@Test
public void testMockBuilderOfDrawableHierarchies() {
  GenericDraweeHierarchy gdh = DraweeMocks.mockDraweeHierarchy();
  GenericDraweeHierarchyBuilder builder =
      DraweeMocks.mockBuilderOf(gdh);
  assertEquals(gdh, builder.build());
  assertEquals(gdh, builder.build());
  assertEquals(gdh, builder.build());
  assertEquals(gdh, builder.build());
  assertEquals(gdh, builder.build());

  GenericDraweeHierarchy gdh1 = DraweeMocks.mockDraweeHierarchy();
  GenericDraweeHierarchy gdh2 = DraweeMocks.mockDraweeHierarchy();
  GenericDraweeHierarchy gdh3 = DraweeMocks.mockDraweeHierarchy();
  GenericDraweeHierarchyBuilder multiBuilder =
      DraweeMocks.mockBuilderOf(gdh1, gdh2, gdh3);
  assertEquals(gdh1, multiBuilder.build());
  assertEquals(gdh2, multiBuilder.build());
  assertEquals(gdh3, multiBuilder.build());
  assertEquals(gdh3, multiBuilder.build());
  assertEquals(gdh3, multiBuilder.build());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:DraweeMocksTest.java

示例2: displayImage

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
private void displayImage(SimpleDraweeView draweeView, String url) {
    GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
    //設置占位圖
    if (hierarchy == null) {
        hierarchy = GenericDraweeHierarchyBuilder.newInstance(getResources())
                .setPlaceholderImage(getResources().getDrawable(R.mipmap.ic_launcher)
                        , ScalingUtils.ScaleType.CENTER).build();
        draweeView.setHierarchy(hierarchy);
    } else {
        hierarchy.setPlaceholderImage(getResources().getDrawable(R.mipmap.ic_launcher)
                , ScalingUtils.ScaleType.CENTER);
    }

    //構建ImageRequestBuilder,傳入請求Uri
    ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url));
    //構建Controller
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(draweeView.getController())
            .setImageRequest(requestBuilder.build())
            .build();
    //設置圖片,Fresco設置顯示圖片都是通過Controller來實現
    draweeView.setController(controller);
}
 
開發者ID:idisfkj,項目名稱:Zoomable,代碼行數:24,代碼來源:MainActivity.java

示例3: generateImageLayout

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
private ViewGroup generateImageLayout() {
    SquareDraweeView imageView = new SquareDraweeView(mContext);

    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(mContext.getResources());
    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(300).setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
            .build();
    if (mPlaceholderImageResId > 0) {
        hierarchy.setPlaceholderImage(mPlaceholderImageResId);
    }
    if (mFailureImageResId > 0) {
        hierarchy.setFailureImage(mFailureImageResId);
    }

    imageView.setHierarchy(hierarchy);
    RelativeLayout.LayoutParams imgLp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    imgLp.setMargins(mImageBorderThickness, mImageBorderThickness, mImageBorderThickness, mImageBorderThickness);
    RelativeLayout mainLayout = new RelativeLayout(mContext);
    mainLayout.setBackgroundColor(mImageBorderColor);
    mainLayout.addView(imageView, imgLp);
    return mainLayout;
}
 
開發者ID:ibosong,項目名稱:CommentGallery,代碼行數:24,代碼來源:CommentImageGrid.java

示例4: createSimpleDraweeView

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
private SimpleDraweeView createSimpleDraweeView() {
    SimpleDraweeView view = new SimpleDraweeView(itemView.getContext());
    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(itemView.getContext().getResources());
    GenericDraweeHierarchy hierarchy = builder
            .setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
            .setPlaceholderImage(R.color.loading_color)
            .setPlaceholderImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
            .setFailureImage(R.mipmap.ic_failed)
            .setFailureImageScaleType(ScalingUtils.ScaleType.CENTER)
            .build();
    view.setHierarchy(hierarchy);
    view.setTag(atomicInteger.getAndIncrement());
    view.setOnClickListener(this);
    return view;
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:17,代碼來源:PhotoPostVH.java

示例5: loadHeadView

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
public static void loadHeadView(Context context, SimpleDraweeView simpleDraweeView, Uri httpUri) {
    //初始化圓角圓形參數對象
    RoundingParams rp = new RoundingParams();
    //設置圖像是否為圓形
    rp.setRoundAsCircle(true);

    final GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(context.getResources())
            .setRoundingParams(rp)
            .build();

    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setUri(httpUri)
            .setTapToRetryEnabled(true)
            .setOldController(simpleDraweeView.getController())
            .build();
    simpleDraweeView.setHierarchy(hierarchy);
    simpleDraweeView.setController(controller);
}
 
開發者ID:lennyup,項目名稱:react-native-udesk,代碼行數:19,代碼來源:UdeskUtil.java

示例6: FrescoBasedReactTextInlineImageSpan

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
public FrescoBasedReactTextInlineImageSpan(
    Resources resources,
    int height,
    int width,
    @Nullable Uri uri,
    ReadableMap headers,
    AbstractDraweeControllerBuilder draweeControllerBuilder,
    @Nullable Object callerContext) {
  mDraweeHolder = new DraweeHolder(
      GenericDraweeHierarchyBuilder.newInstance(resources)
          .build()
  );
  mDraweeControllerBuilder = draweeControllerBuilder;
  mCallerContext = callerContext;

  mHeight = height;
  mWidth = width;
  mUri = (uri != null) ? uri : Uri.EMPTY;
  mHeaders = headers;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:21,代碼來源:FrescoBasedReactTextInlineImageSpan.java

示例7: FrescoBasedReactTextInlineImageSpan

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
public FrescoBasedReactTextInlineImageSpan(
    Resources resources,
    int height,
    int width,
    @Nullable Uri uri,
    AbstractDraweeControllerBuilder draweeControllerBuilder,
    @Nullable Object callerContext) {
  mDraweeHolder = new DraweeHolder(
      GenericDraweeHierarchyBuilder.newInstance(resources)
          .build()
  );
  mDraweeControllerBuilder = draweeControllerBuilder;
  mCallerContext = callerContext;

  mHeight = height;
  mWidth = width;
  mUri = (uri != null) ? uri : Uri.EMPTY;
}
 
開發者ID:john1jan,項目名稱:ReactNativeSignatureExample,代碼行數:19,代碼來源:FrescoBasedReactTextInlineImageSpan.java

示例8: init

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
protected void init() {
    if (null == mAttacher || null == mAttacher.getImageView()) {
        mAttacher = new PhotoViewAttacher(this);
    }

    if (null != mPendingScaleType) {
        setScaleType(mPendingScaleType);
        mPendingScaleType = null;
    }

    if (mDraweeHolder == null) {
        GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
                .setFadeDuration(500)
                .setProgressBarImage(new CustomProgressbarDrawable(this))
                .build();
        mDraweeHolder = DraweeHolder.create(hierarchy, getContext());
    }
}
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:19,代碼來源:PhotoView.java

示例9: getGenericDraweeHierarchy

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
public static GenericDraweeHierarchy getGenericDraweeHierarchy(Context context){
      GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(context.getResources())
//            .reset()//重置
//            .setActualImageColorFilter(colorFilter)//顏色過濾
//            .setActualImageFocusPoint(focusPoint)//focusCrop, 需要指定一個居中點
//            .setActualImageMatrix(actualImageMatrix)
//            .setActualImageScaleType(actualImageScaleType)//fresco:actualImageScaleType="focusCrop"縮放類型
//            .setBackground(background)//fresco:backgroundImage="@color/blue"背景圖片
//            .setBackgrounds(backgrounds)
//            .setFadeDuration(fadeDuration)//fresco:fadeDuration="300"加載圖片動畫時間
              .setFailureImage(ConfigConstants.sErrorDrawable)//fresco:failureImage="@drawable/error"失敗圖
//            .setFailureImage(failureDrawable, failureImageScaleType)//fresco:failureImageScaleType="centerInside"失敗圖縮放類型
//            .setOverlay(overlay)//fresco:overlayImage="@drawable/watermark"疊加圖
//            .setOverlays(overlays)
              .setPlaceholderImage(ConfigConstants.sPlaceholderDrawable)//fresco:placeholderImage="@color/wait_color"占位圖
//            .setPlaceholderImage(placeholderDrawable, placeholderImageScaleType)//fresco:placeholderImageScaleType="fitCenter"占位圖縮放類型
//            .setPressedStateOverlay(drawable)//fresco:pressedStateOverlayImage="@color/red"按壓狀態下的疊加圖
              .setProgressBarImage(new ProgressBarDrawable())//進度條fresco:progressBarImage="@drawable/progress_bar"進度條
//            .setProgressBarImage(progressBarImage, progressBarImageScaleType)//fresco:progressBarImageScaleType="centerInside"進度條類型
//            .setRetryImage(retryDrawable)//fresco:retryImage="@drawable/retrying"點擊重新加載
//            .setRetryImage(retryDrawable, retryImageScaleType)//fresco:retryImageScaleType="centerCrop"點擊重新加載縮放類型
              .setRoundingParams(RoundingParams.asCircle())//圓形/圓角fresco:roundAsCircle="true"圓形
              .build();
      return gdh;
  }
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:26,代碼來源:ConfigConstants.java

示例10: onCreate

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_image);

    final SimpleDraweeView mImageView = (SimpleDraweeView) findViewById(R.id.view_image_image);
    final int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
    final GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
        .setFadeDuration(shortAnimTime)
        .setProgressBarImage(new ImageLoadingDrawable(getResources()))
        .setFailureImage(getResources().getDrawable(R.drawable.ic_upload_failed), ScalingUtils.ScaleType.CENTER_INSIDE)
        .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
        .build();
    mImageView.setHierarchy(hierarchy);

    mImageView.setImageURI(getIntent().getParcelableExtra(EXTRA_IMAGE_URI));
}
 
開發者ID:badoo,項目名稱:Chateau,代碼行數:18,代碼來源:FullScreenImageActivity.java

示例11: instantiateItem

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    ZoomableDraweeView view = new ZoomableDraweeView(container.getContext());
    view.setController(
            Fresco.newDraweeControllerBuilder()
                    .setUri(Uri.parse(items[position]))
                    .build());

    GenericDraweeHierarchy hierarchy =
            new GenericDraweeHierarchyBuilder(container.getResources())
                    .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
                    .setProgressBarImage(new ProgressBarDrawable())
                    .build();

    view.setHierarchy(hierarchy);

    container.addView(view,
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    return view;
}
 
開發者ID:kunny,項目名稱:ZoomableDraweeView-sample,代碼行數:22,代碼來源:ViewPagerActivity.java

示例12: getView

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = layoutInflater.inflate(R.layout.item_data, null);
        ViewHolder viewHolder = new ViewHolder();
        viewHolder.myImageView = (SimpleDraweeView) convertView.findViewById(R.id.my_image_view);
        viewHolder.myTitle = (TextView) convertView.findViewById(R.id.my_title);
        viewHolder.myContent = (TextView) convertView.findViewById(R.id.my_content);
        GenericDraweeHierarchyBuilder builder =
                new GenericDraweeHierarchyBuilder(context.getResources());
        GenericDraweeHierarchy hierarchy = builder
                .setFadeDuration(200)
                .setPlaceholderImage(new ColorDrawable(0xf2f2f2))
                .setProgressBarImage(new CircularProgressDrawable())
                .build();
        viewHolder.myImageView.setHierarchy(hierarchy);
        convertView.setTag(viewHolder);
    }
    initializeViews(getItem(position), (ViewHolder) convertView.getTag());
    return convertView;
}
 
開發者ID:dodola,項目名稱:ListItemFold,代碼行數:22,代碼來源:ItemDataAdapter.java

示例13: init

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
private void init() {

        if (isInEditMode()) {
            return;
        }

        GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());

        builder.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
        builder.setOverlay(new CoverOverlayDrawable(getContext()));

        if (ActorSDK.sharedActor().style.getAvatarBackgroundResourse() != 0) {
            builder.setPlaceholderImage(getResources()
                    .getDrawable(ActorSDK.sharedActor().style.getAvatarBackgroundResourse()), ScalingUtils.ScaleType.CENTER_CROP);
        } else {
            builder.setPlaceholderImage(new ColorDrawable(
                    ActorSDK.sharedActor().style.getAvatarBackgroundColor()));
        }

        builder.setFadeDuration(0);

        setHierarchy(builder.build());
    }
 
開發者ID:actorapp,項目名稱:actor-platform,代碼行數:24,代碼來源:CoverAvatarView.java

示例14: init

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
public void init() {
    if(blurActor==null){
        blurActor = system().actorOf(Props.create(new ActorCreator() {
            @Override
            public BlurActor create() {
                return new BlurActor();
            }
        }), "actor/call_blur");
    }
    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(getResources());

    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(200)
            .build();
    setHierarchy(hierarchy);
}
 
開發者ID:actorapp,項目名稱:actor-platform,代碼行數:18,代碼來源:CallBackgroundAvatarView.java

示例15: init

import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入依賴的package包/類
public void init(int size, float placeholderTextSize) {
    this.size = size;
    this.placeholderTextSize = placeholderTextSize;

    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(getResources());

    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(200)
            .setRoundingParams(new RoundingParams()
                    .setRoundAsCircle(true)
                    .setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY))
            //.setActualImageColorFilter(new PorterDuffColorFilter(0x19000000, PorterDuff.Mode.MULTIPLY))
            //.setOverlay(new AvatarBorderDrawable())
            .build();
    setHierarchy(hierarchy);
}
 
開發者ID:actorapp,項目名稱:actor-platform,代碼行數:18,代碼來源:AvatarView.java


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