Giter Site home page Giter Site logo

bgaphotopicker-android's Introduction

🏃BGAPhotoPicker-Android🏃

Maven Central

MeiqiaSDK-Android 里的图库单独抽出来开源,将其中的 GridView、ListView和RelativeLayout 换成 RecyclerView 和 Toolbar,方便在以后的项目中直接依赖使用。Demo 中模仿了微信朋友圈的部分功能,详细用法请查看 Demo。希望能该库帮正在做这几个功能的猿友节省开发时间。

如有需要集成「在线客服功能」的猿友,欢迎使用 美洽

主要功能

  • 单图选择
  • 多图选择
  • 拍照选择
  • 图片选择预览(支持微博长图)、缩放查看
  • 图片预览(支持微博长图)、缩放查看
  • 支持 glide、picasso、universal-image-loader、xutils 图片加载库
  • 正方形、圆形头像、带边框的圆形头像控件
  • 朋友圈列表界面的九宫格图片控件
  • 发布朋友圈界面的可拖拽排序的九宫格图片控件
  • 覆盖相应的资源文件来定制界面

效果图与示例 apk

bga-photopicker3

点击下载 BGAPhotoPickerDemo.apk 或扫描下面的二维码安装

bga_photopicker_qrcode1

Gradle 依赖

Maven Central 「latestVersion」指的是左边这个 maven-central 徽章后面的「数字」,请自行替换。请不要再来问我「latestVersion」是什么了

由于需要支持微博长图预览,该库中已经引入了 PhotoView 的源码并进行了修改,所以你的项目中就不要再重复引入 PhotoView

dependencies {
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    compile 'cn.bingoogolapple:bga-adapter:1.1.0@aar'

    compile 'cn.bingoogolapple:bga-photopicker:latestVersion@aar'

    // 必须依赖下面四个图片加载库中的某一个
    compile 'com.github.bumptech.glide:glide:3.7.0'
//    compile 'com.squareup.picasso:picasso:2.5.2'
//    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//    compile 'org.xutils:xutils:3.3.36'
}

接口说明

BGAPhotoPickerActivity

/**
 * @param context        应用程序上下文
 * @param imageDir       拍照后图片保存的目录。如果传null表示没有拍照功能,如果不为null则具有拍照功能,
 * @param maxChooseCount 图片选择张数的最大值
 * @param selectedImages 当前已选中的图片路径集合,可以传null
 * @return
 */
public static Intent newIntent(Context context, File imageDir, int maxChooseCount, ArrayList<String> selectedImages)

/**
 * 获取已选择的图片集合
 *
 * @param intent
 * @return
 */
public static ArrayList<String> getSelectedImages(Intent intent)

BGAPhotoPreviewActivity

/**
 * 获取查看多张图片的intent
 *
 * @param context
 * @param saveImgDir      保存图片的目录,如果传null,则没有保存图片功能
 * @param previewImages   当前预览的图片目录里的图片路径集合
 * @param currentPosition 当前预览图片的位置
 * @return
 */
public static Intent newIntent(Context context, File saveImgDir, ArrayList<String> previewImages, int currentPosition)

/**
 * 获取查看单张图片的intent
 *
 * @param context
 * @param saveImgDir 保存图片的目录,如果传null,则没有保存图片功能
 * @param photoPath  图片路径
 * @return
 */
public static Intent newIntent(Context context, File saveImgDir, String photoPath)

详细用法请查看 Demo🐾

Proguard

## ----------------------------------
##      UIL相关
## ----------------------------------
-keep class com.nostra13.universalimageloader.** { *; }
-keepclassmembers class com.nostra13.universalimageloader.** {*;}
-dontwarn com.nostra13.universalimageloader.**

## ----------------------------------
##      Glide相关
## ----------------------------------
-keep class com.bumptech.glide.Glide { *; }
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}
-dontwarn com.bumptech.glide.**

## ----------------------------------
##      Picasso相关
## ----------------------------------
-keep class com.squareup.picasso.Picasso { *; }
-dontwarn com.squareup.okhttp.**
-dontwarn com.squareup.picasso.**

## ----------------------------------
##      xUtils3相关
## ----------------------------------
-keepattributes Signature,*Annotation*
-keep public class org.xutils.** {
    public protected *;
}
-keep public interface org.xutils.** {
    public protected *;
}
-keepclassmembers class * extends org.xutils.** {
    public protected *;
}
-keepclassmembers @org.xutils.db.annotation.* class * {*;}
-keepclassmembers @org.xutils.http.annotation.* class * {*;}
-keepclassmembers class * {
    @org.xutils.view.annotation.Event <methods>;
}
-dontwarn org.xutils.**

关于我

新浪微博 个人主页 邮箱 BGA系列开源库QQ群
bingoogolapple bingoogolapple.cn [email protected] BGA_CODE_CLUB

打赏支持

如果觉得 BGA 系列开源库对您有用,请随意打赏。

bgaphotopicker-android's People

Contributors

bingoogolapple avatar

Watchers

 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.