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


Java DraweeController类代码示例

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


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

示例1: obtainController

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
@Override
protected PipelineDraweeController obtainController() {
  DraweeController oldController = getOldController();
  PipelineDraweeController controller;
  if (oldController instanceof PipelineDraweeController) {
    controller = (PipelineDraweeController) oldController;
    controller.initialize(
        obtainDataSourceSupplier(),
        generateUniqueControllerId(),
        getCacheKey(),
        getCallerContext(),
        mCustomDrawableFactories);
  } else {
    controller = mPipelineDraweeControllerFactory.newController(
        obtainDataSourceSupplier(),
        generateUniqueControllerId(),
        getCacheKey(),
        getCallerContext(),
        mCustomDrawableFactories);
  }
  return controller;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:PipelineDraweeControllerBuilder.java

示例2: obtainController

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
@Override
protected VolleyDraweeController obtainController() {
  DraweeController oldController = getOldController();
  VolleyDraweeController controller;
  if (oldController instanceof VolleyDraweeController) {
    controller = (VolleyDraweeController) oldController;
    controller.initialize(
        obtainDataSourceSupplier(),
        generateUniqueControllerId(),
        getCallerContext());
  } else {
    controller = mVolleyDraweeControllerFactory.newController(
        obtainDataSourceSupplier(),
        generateUniqueControllerId(),
        getCallerContext());
  }
  return controller;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:VolleyDraweeControllerBuilder.java

示例3: setController

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
/**
 * Sets a new controller.
 */
public void setController(@Nullable DraweeController draweeController) {
  boolean wasAttached = mIsControllerAttached;
  if (wasAttached) {
    detachController();
  }

  // Clear the old controller
  if (isControllerValid()) {
    mEventTracker.recordEvent(Event.ON_CLEAR_OLD_CONTROLLER);
    mController.setHierarchy(null);
  }
  mController = draweeController;
  if (mController != null) {
    mEventTracker.recordEvent(Event.ON_SET_CONTROLLER);
    mController.setHierarchy(mHierarchy);
  } else {
    mEventTracker.recordEvent(Event.ON_CLEAR_CONTROLLER);
  }

  if (wasAttached) {
    attachController();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:DraweeHolder.java

示例4: stubControllerListener

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
/**
 * Stubs addControllerListener
 * @param controller
 * @return forwarding listener
 */
public static ControllerListener stubControllerListener(
    final DraweeController controller) {
  final ForwardingControllerListener forwardingListener = new ForwardingControllerListener();
  if (!(controller instanceof AbstractDraweeController)) {
    return null;
  }
  AbstractDraweeController abstractController = (AbstractDraweeController) controller;
  doAnswer(
      new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
          forwardingListener.addListener((ControllerListener) invocation.getArguments()[0]);
          return null;
        }
      }).when(abstractController).addControllerListener(any(ControllerListener.class));
  return forwardingListener;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:DraweeMocks.java

示例5: setImageSpan

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
public void setImageSpan(
    Context context,
    DraweeHierarchy draweeHierarchy,
    DraweeController draweeController,
    int index,
    final int drawableWidthPx,
    final int drawableHeightPx,
    boolean enableResizing,
    @BetterImageSpan.BetterImageSpanAlignment int verticalAlignment) {
  setImageSpan(
      context,
      draweeHierarchy,
      draweeController,
      index,
      index,
      drawableWidthPx,
      drawableHeightPx,
      enableResizing,
      verticalAlignment);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:DraweeSpanStringBuilder.java

示例6: onBind

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
@Override
protected void onBind(String uriString) {
  Uri uri = Uri.parse(uriString);
  ImageRequestBuilder imageRequestBuilder =
      ImageRequestBuilder.newBuilderWithSource(uri);
  if (UriUtil.isNetworkUri(uri)) {
    imageRequestBuilder.setProgressiveRenderingEnabled(true);
  } else {
    imageRequestBuilder.setResizeOptions(new ResizeOptions(
        mImageView.getLayoutParams().width,
        mImageView.getLayoutParams().height));
  }
  DraweeController draweeController = Fresco.newDraweeControllerBuilder()
      .setImageRequest(imageRequestBuilder.build())
      .setOldController(mImageView.getController())
      .setControllerListener(mImageView.getListener())
      .setAutoPlayAnimations(true)
      .build();
  mImageView.setController(draweeController);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:FrescoHolder.java

示例7: onDraw

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
  int saveCount = canvas.save();
  canvas.concat(mZoomableController.getTransform());
  try {
    super.onDraw(canvas);
  } catch (Exception e) {
    DraweeController controller = getController();
    if (controller != null && controller instanceof AbstractDraweeController) {
      Object callerContext = ((AbstractDraweeController) controller).getCallerContext();
      if (callerContext != null) {
        throw new RuntimeException(
            String.format("Exception in onDraw, callerContext=%s", callerContext.toString()),
            e);
      }
    }
    throw e;
  }
  canvas.restoreToCount(saveCount);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:ZoomableDraweeView.java

示例8: initAnimation

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void initAnimation(View view) {
  mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
  mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setOldController(mSimpleDraweeView.getController())
      .setUri(URI_KEYFRAMES_ANIMATION)
      .setAutoPlayAnimations(true)
      .build();
  mSimpleDraweeView.setController(controller);

  final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
  switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked
          ? new CheckerBoardDrawable(getResources())
          : null);
    }
  });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:ImageFormatKeyframesFragment.java

示例9: loadThumb

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
private void loadThumb(
    SimpleDraweeView draweeView,
    Size size,
    ImageRequest.RequestLevel requestLevel) {
  ImageRequest request = ImageRequestBuilder.newBuilderWithSource(size.uri)
      .setMediaVariations(MediaVariations.newBuilderForMediaId(MEDIA_ID)
          .setForceRequestForSpecifiedUri(true)
          .build())
      .setLowestPermittedRequestLevel(requestLevel)
      .setResizeOptions(new ResizeOptions(draweeView.getWidth(), draweeView.getHeight()))
      .setCacheChoice(size.cacheChoice)
      .build();
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setImageRequest(request)
      .setOldController(draweeView.getController())
      .build();
  draweeView.setController(controller);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:MediaVariationsFragment.java

示例10: instantiateItem

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
  FrameLayout page = (FrameLayout) container.getChildAt(position);
  if (page == null) {
    return null;
  }
  ZoomableDraweeView zoomableDraweeView =
          (ZoomableDraweeView) page.findViewById(R.id.zoomableView);
  zoomableDraweeView.setAllowTouchInterceptionWhileZoomed(mAllowSwipingWhileZoomed);
  // needed for double tap to zoom
  zoomableDraweeView.setIsLongpressEnabled(false);
  zoomableDraweeView.setTapListener(new DoubleTapGestureListener(zoomableDraweeView));
  DraweeController controller = Fresco.newDraweeControllerBuilder()
    .setUri(SAMPLE_URIS[position % SAMPLE_URIS.length])
    .setCallerContext("ZoomableApp-MyPagerAdapter")
    .build();
  zoomableDraweeView.setController(controller);
  page.requestLayout();
  return page;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:MyPagerAdapter.java

示例11: displayImage

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的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

示例12: instantiateItem

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = LayoutInflater.from(mContext).inflate(R.layout.zoomable_view_pager_item, null);
    ZoomableDraweeView zoomableDraweeView = (ZoomableDraweeView) view.findViewById(R.id.zoomable_image);
    //允许缩放时切换
    zoomableDraweeView.setAllowTouchInterceptionWhileZoomed(true);
    //长按
    zoomableDraweeView.setIsLongpressEnabled(false);
    //双击击放大或缩小
    zoomableDraweeView.setTapListener(new DoubleTapGestureListener(zoomableDraweeView));

    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setUri(mPaths.get(position))
            .build();
    //加载图片
    zoomableDraweeView.setController(draweeController);
    container.addView(view);
    view.requestLayout();
    return view;
}
 
开发者ID:idisfkj,项目名称:Zoomable,代码行数:21,代码来源:ZoomableViewPagerAdapter.java

示例13: layoutChildrenView

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
private void layoutChildrenView() {
    int childrenCount = getChildCount();

    for (int i = 0; i < childrenCount; i++) {
        ViewGroup childImageLayout = (ViewGroup) getChildAt(i);
        SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0);
        if (mOnItemClickListener != null) {
            final int finalI = i;
            childImageLayout.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    mOnItemClickListener.OnItemClick(finalI);
                }
            });
        }
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i)))
                .setProgressiveRenderingEnabled(true)
                .setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth))
                .build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(request)
                .setOldController(childImageView.getController())
                .build();
        childImageView.setController(controller);

        int[] position = findPosition(i);
        int itemHeight = mItemWidth;
        int left = (int) (mItemWidth + mHorizontalSpace) * position[1];
        int top = (int) (itemHeight + mVerticalSpace) * position[0];
        int right = left + mItemWidth;
        int bottom = top + itemHeight;

        childImageLayout.layout(left, top, right, bottom);
    }
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:36,代码来源:CommentImageGrid.java

示例14: refreshImageChild

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
private void refreshImageChild() {
    int childrenCount = getChildCount();
    if (childrenCount > 0) {
        for (int i = 0; i < childrenCount; i++) {
            ViewGroup childImageLayout = (ViewGroup) getChildAt(i);
            SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0);
            if (mOnItemClickListener != null) {
                final int finalI = i;
                childImageLayout.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mOnItemClickListener.OnItemClick(finalI);
                    }
                });
            }
            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i)))
                    .setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth))
                    .build();
            DraweeController controller = Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setOldController(childImageView.getController())
                    .build();
            childImageView.setController(controller);
        }
    }
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:27,代码来源:CommentImageGrid.java

示例15: onCreate

import com.facebook.drawee.interfaces.DraweeController; //导入依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    ButterKnife.bind(this);
    Uri uri = Uri.parse("asset:///splash.webp");
    mSplashPresenter = new SplashPresenterImpl(this);
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setUri(uri)
            .setAutoPlayAnimations(true)
            .setControllerListener(new BaseControllerListener<ImageInfo>(){
                @Override
                public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) {
                    super.onFinalImageSet(id, imageInfo, animatable);
                    mSplashPresenter.startCountDown(1);
                }
            })
            .build();
    splashDraweee.setController(controller);
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:21,代码来源:SplashActivity.java


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