名称 | 版本 | 描述 |
---|---|---|
pejoy-core | 图片选择核心lib | |
pejoy-fresco | 图片选择引擎 | |
pejoy-glide | 图片选择引擎 | |
pejoy-compress | image compress |
Pejoy是一个设计良好的Android本地图片选择和视频选择框架,基于Matisse.
- 在Activity或Fragment随意使用
- 选择图片包括JPEG,PNG,GIF,视频包括MEPG,MP4
- 通过不同的主题来进行呈现,默认包含两种主题,支持自定义
- 可使用不同的图片加载器
- 可使用多种的过滤器
- 还有更多等着你发现
主题 | 相册 | 相册分类 | 相册预览 |
---|---|---|---|
Dracula | |||
Light | |||
Custom |
gradle:
步骤一: 添加core lib
dependencies {
implementation 'io.github.keep2iron:pejoy-core:$latest_version'
//provide imageloader engine
implementation 'io.github.keep2iron:pejoy-engine:$latest_version'
//optional compress image use Luban compress lib
implementation 'io.github.keep2iron:pejoy-compress:$latest_version'
}
步骤二:添加image lib 两者选则其一即可
Glide version
dependencies {
implementation 'com.github.bumptech.glide:glide:$latest_version'
implementation 'io.github.keep2iron:pejoy-glide:$latest_version'
implementation 'io.github.keep2iron:pineapple-glide:$latest_version'
}
Fresco version
dependencies {
implementation 'com.facebook.fresco:fresco:$latest_version'
implementation 'io.github.keep2iron:pejoy-fresco:$latest_version'
implementation 'io.github.keep2iron:pineapple-fresco:$latest_version'
}
可选:添加压缩图片组件
dependencies {
implementation 'io.github.keep2iron:pejoy-compress:$latest_version'
}
两种使用方法
由于使用了Pineapple 所以需要在application onCreate的方法中添加如下代码.
ImageLoaderManager.init(application)
Pejoy.create(this)
.choose(MimeType.ofAll(), false)
.maxSelectable(3)
.countable(true)
.originalEnable(true)
.capture(true, enableInsertAlbum = true)
.toObservable()
.extractStringPath() //or extractUriPath()
.subscribe { paths->
}
Pejoy.create(this)
.choose(MimeType.ofAll(), false)
.maxSelectable(3)
.countable(true)
.originalEnable(true)
.capture(true, enableInsertAlbum = true)
.toObservable()
.weatherCompressImage(this) // when original not checked.compress will execute.
.subscribe { paths->
}
Pejoy.create(this)
.capture()
.originalEnable(true)
.toObservable()
.weatherCompressImage(requireContext())
.subscribe {
imageResultBuilder.append("[\n")
it.forEach { uri ->
imageResultBuilder.apply {
append(uri)
if (uri != it.last()) {
append("\n")
} else {
append("\n]\n")
}
}
}
tvImageResult.text = imageResultBuilder.toString()
Log.d("keep2iron", it.toString() + "this : " + this.hashCode())
}
No need......
Copyright 2019 Keep2iron.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.