Giter Site home page Giter Site logo

animphotoview's Introduction

仿微信朋友圈图片浏览photoview

这是第一版功能:支持多图浏览,可放大缩小 后续第二版会增加微信的手势功能

demo

项目中的示例

如何使用

Android Studio

第一步:
  在项目的gradle里配置
  allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
  }

  第二步:
  在module的gradle里配置
  dependencies {
     ...
  	 compile ('com.github.shajinyang:animphotoview:1.1.1'){
                 exclude group: "com.android.support"
         }
  }

代码示例:recycleview的item点击

 AnimPhotoView pv;
 ArrayList<GallBean> list=new ArrayList<>();
 ...

@Override
public void onClick(View v) {
    Gallery.getInstance()
            .isAnima(true)
            .with(BrowActivity.this)//必须传递activity
            .fromView(v)//动画开始的view,一般为imageview
            .currentPostion(position)//当前位置
            .loadImages(list)//图片集合
            //自定义图片加载器
            .setLoader(new IPhotoLoader() {
                @Override
                public void loadImg(GallBean gallBean, ImageView targertView) {

                    //glide加载 或者其他加载方式
                    Glide.with(BrowActivity.this)
                        .load(gallBean.getImgPath())
                        .into(targertView);

                }
            })
            //监听回调,一般在fragment多图片切换时回调,需要重新调用绑定关系方法
            .setonPageChangeListener(new OnPageChangeListener() {
                @Override
                public void onPageChange(int position) {
                    Gallery.getInstance()
                            .onBindChange(rv.getChildAt(position),position);
                }
            })
            .start();
}

...

如果你不想使用动画效果,想直接跳转查看图片 可以这么调用:

Gallery.getInstance()
        .isAnima(false)
        .with(BrowActivity.this)
        .loadImages(list)
        .currentPostion(position)
        .setLoader(new IPhotoLoader() {
            @Override
            public void loadImg(GallBean gallBean, final ImageView targertView) {
                Glide.with(BrowActivity.this)
                        .load(gallBean.getImgPath())
                        .into(targertView);
            }
        })
        .start();

animphotoview's People

Contributors

shajinyang avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.