Search in sources :

Example 1 with ZoomableDraweeView

use of com.facebook.samples.zoomable.ZoomableDraweeView in project fresco by facebook.

the class MyPagerAdapter method destroyItem.

@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);
}
Also used : FrameLayout(android.widget.FrameLayout) ZoomableDraweeView(com.facebook.samples.zoomable.ZoomableDraweeView)

Example 2 with ZoomableDraweeView

use of com.facebook.samples.zoomable.ZoomableDraweeView in project fresco by facebook.

the class MyPagerAdapter method instantiateItem.

@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]).build();
    zoomableDraweeView.setController(controller);
    page.requestLayout();
    return page;
}
Also used : DoubleTapGestureListener(com.facebook.samples.zoomable.DoubleTapGestureListener) DraweeController(com.facebook.drawee.interfaces.DraweeController) FrameLayout(android.widget.FrameLayout) ZoomableDraweeView(com.facebook.samples.zoomable.ZoomableDraweeView)

Aggregations

FrameLayout (android.widget.FrameLayout)2 ZoomableDraweeView (com.facebook.samples.zoomable.ZoomableDraweeView)2 DraweeController (com.facebook.drawee.interfaces.DraweeController)1 DoubleTapGestureListener (com.facebook.samples.zoomable.DoubleTapGestureListener)1