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

项目: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;
}
项目: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;
}
项目:apps-android-wikipedia    文件:GalleryItemFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_gallery_item, container, false);
    progressBar = rootView.findViewById(R.id.gallery_item_progress_bar);
    videoContainer = rootView.findViewById(R.id.gallery_video_container);
    videoView = rootView.findViewById(R.id.gallery_video);
    videoThumbnail = rootView.findViewById(R.id.gallery_video_thumbnail);
    videoPlayButton = rootView.findViewById(R.id.gallery_video_play_button);
    imageView = rootView.findViewById(R.id.gallery_image);
    imageView.setTapListener(new DoubleTapGestureListener(imageView) {
        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            parentActivity.toggleControls();
            return true;
        }
    });
    GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
            .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
            .build();
    imageView.setHierarchy(hierarchy);
    return rootView;
}