Java 类com.facebook.samples.zoomable.ZoomableDraweeView 实例源码

项目:GitHub    文件:MyPagerAdapter.java   
@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;
}
项目:ZoomableDraweeView-sample    文件:ViewPagerActivity.java   
@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;
}
项目:fresco    文件:MyPagerAdapter.java   
@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;
}
项目:ZoomableDraweeView-sample    文件:ZoomableActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Uri data = getIntent().getData();
    if (null == data) {
        throw new IllegalArgumentException("No data to display");
    }

    String title = getIntent().getStringExtra(KEY_TITLE);
    if (title != null) {
        setTitle(title);
    }

    Fresco.initialize(this);
    setContentView(R.layout.activity_zoomable);

    ZoomableDraweeView view = (ZoomableDraweeView) findViewById(R.id.zoomable);

    DraweeController ctrl = Fresco.newDraweeControllerBuilder().setUri(
            data).setTapToRetryEnabled(true).build();
    GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
            .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
            .setProgressBarImage(new ProgressBarDrawable())
            .build();

    view.setController(ctrl);
    view.setHierarchy(hierarchy);
}
项目:GitHub    文件:MyPagerAdapter.java   
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
  FrameLayout page = (FrameLayout) container.getChildAt(position);
  ZoomableDraweeView zoomableDraweeView = (ZoomableDraweeView) page.getChildAt(0);
  zoomableDraweeView.setController(null);
}
项目:fresco    文件:MyPagerAdapter.java   
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
  FrameLayout page = (FrameLayout) container.getChildAt(position);
  ZoomableDraweeView zoomableDraweeView = (ZoomableDraweeView) page.getChildAt(0);
  zoomableDraweeView.setController(null);
}
项目:ZoomableFrescoExample    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Fresco.initialize(this);

    setContentView(R.layout.activity_main);

    imageView = (ZoomableDraweeView)findViewById(R.id.entry_image_view);
}