Search in sources :

Example 1 with DoubleTapGestureListener

use of com.facebook.samples.zoomable.DoubleTapGestureListener 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)1 DraweeController (com.facebook.drawee.interfaces.DraweeController)1 DoubleTapGestureListener (com.facebook.samples.zoomable.DoubleTapGestureListener)1 ZoomableDraweeView (com.facebook.samples.zoomable.ZoomableDraweeView)1