Skip to content

liuzhanta/PhotoDraweeView

Repository files navigation

PhotoDraweeView

PhotoDraweeView是基于PhotoView和Fresco的SimpleDraweeView进行改造的可以缩放的 图片加载控件,你可以很简单的加载一张图片并且加上缩放手势。

Getting started

Add the PhotoDraweeView dependency to your build.gradle.

dependencies {
    compile 'com.lzt.photodraweeview:photodraweeview:1.0.1''
}

Screenshot

GitHub set up

Usage Code

configuring Fresco PipelineDraweeController

 PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
                    .setOldController(photoDraweeView.getController())
                    .setControllerListener(new BaseControllerListener<ImageInfo>() {
                        @Override
                        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
                            super.onFinalImageSet(id, imageInfo, animatable);
                            progressBar.setVisibility(View.GONE);
                            photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
                            if (imageInfo == null || photoDraweeView == null) {
                                return;
                            }
                        }
                    })
                    .setImageRequest(request)
                    .build();

 photoDraweeView.setController(controller);

And you can set a photo tab listener on image like following this:

photoDraweeView.setOnPhotoTapListener(new OnPhotoTapListener() {
                @Override
                public void onPhotoTap(View view, float x, float y) {
                    Toast.makeText(MainActivity.this, "onPhotoTap!", Toast.LENGTH_SHORT).show();
                }
});

Developed by

Name: Terry Liu

E-mail: tata1989y@gmail.com

Subject: PhotoDraweeView

About

PhotoDraweeView(图片缩放控件)-for Fresco

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages