Skip to content

Latest commit

 

History

History
167 lines (130 loc) · 4.94 KB

README.zh-cn.md

File metadata and controls

167 lines (130 loc) · 4.94 KB

Image

Pejoy

BuildStatus

名称 版本 描述
pejoy-core Release 图片选择核心lib
pejoy-fresco Release 图片选择引擎
pejoy-glide Release 图片选择引擎
pejoy-compress Release image compress

Pejoy是一个设计良好的Android本地图片选择和视频选择框架,基于Matisse.

  • 在Activity或Fragment随意使用
  • 选择图片包括JPEG,PNG,GIF,视频包括MEPG,MP4
  • 通过不同的主题来进行呈现,默认包含两种主题,支持自定义
  • 可使用不同的图片加载器
  • 可使用多种的过滤器
  • 还有更多等着你发现

Preview

主题 相册 相册分类 相册预览
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'
}

简单使用

两种使用方法

  • 基础 仅仅只是选择图片或视频

  • 扩展 选择图片并且压缩他们

初始化ImageLoaderManger

由于使用了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())
    }

ProGuard

No need......

License

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.