Search in sources :

Example 1 with OnViewTapListener

use of me.relex.photodraweeview.OnViewTapListener in project ride-read-android by Ride-Read.

the class ImageActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    imageUrl = getIntent().getStringExtra(IMAGE);
    if (imageUrl.startsWith("/")) {
        imageUrl = "file://" + imageUrl;
    }
    final PhotoDraweeView photoDraweeView = (PhotoDraweeView) findViewById(R.id.iv_image_activity);
    photoDraweeView.setOnViewTapListener(new OnViewTapListener() {

        @Override
        public void onViewTap(View view, float x, float y) {
            onBackPressed();
        }
    });
    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
    controller.setUri(Uri.parse(imageUrl));
    controller.setOldController(photoDraweeView.getController());
    controller.setControllerListener(new BaseControllerListener<ImageInfo>() {

        @Override
        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
            super.onFinalImageSet(id, imageInfo, animatable);
            if (imageInfo == null) {
                return;
            }
            photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
        }
    });
    photoDraweeView.setController(controller.build());
}
Also used : OnViewTapListener(me.relex.photodraweeview.OnViewTapListener) Animatable(android.graphics.drawable.Animatable) PhotoDraweeView(me.relex.photodraweeview.PhotoDraweeView) ImageInfo(com.facebook.imagepipeline.image.ImageInfo) View(android.view.View) PhotoDraweeView(me.relex.photodraweeview.PhotoDraweeView) PipelineDraweeControllerBuilder(com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)

Aggregations

Animatable (android.graphics.drawable.Animatable)1 View (android.view.View)1 PipelineDraweeControllerBuilder (com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)1 ImageInfo (com.facebook.imagepipeline.image.ImageInfo)1 OnViewTapListener (me.relex.photodraweeview.OnViewTapListener)1 PhotoDraweeView (me.relex.photodraweeview.PhotoDraweeView)1