出来了select java application_PictureSelector 最近项目中用到多图选择上传的需求,随后百度了一下用了别人写的 demo,发现在很多机型上各种 @codeKK An...

A Picture Selector for Android platform, support from the album to obtain pictures, video, audio & photo, support crop (single picture or multi-picture crop), compression, theme custom configuration and other functions, support dynamic access & adapt to Android 5.0+ system of open source picture selection framework。

PictureSelector.svg

PRs-Welcome-brightgreen.svg

luck_mw.svg?style=social

PictureSelector.svg

PictureSelector.svg

Directory

Version

step 1

implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.6.0'

step 2

allprojects {

repositories {

jcenter()

maven { url 'https://jitpack.io' }

}

}

Photo

Quick call, more functions More

1、onActivityResult

PictureSelector.create(this)

.openGallery(PictureMimeType.ofImage())

.loadImageEngine(GlideEngine.createGlideEngine()) // Please refer to the Demo GlideEngine.java

.forResult(PictureConfig.CHOOSE_REQUEST);

@Override

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

super.onActivityResult(requestCode, resultCode, data);

if (resultCode == RESULT_OK) {

switch (requestCode) {

case PictureConfig.CHOOSE_REQUEST:

// onResult Callback

List selectList = PictureSelector.obtainMultipleResult(data);

break;

default:

break;

}

}

2、Callback

PictureSelector.create(this)

.openGallery(PictureMimeType.ofAll())

.loadImageEngine(GlideEngine.createGlideEngine())

.forResult(new OnResultCallbackListener() {

@Override

public void onResult(List result) {

// onResult Callback

}

@Override

public void onCancel() {

// onCancel Callback

}

});

Camera

Quick Use, separately start the photo or video according to PictureMimeType automatic recognition More

onActivityResult

PictureSelector.create(this)

.openCamera(PictureMimeType.ofImage())

.loadImageEngine(GlideEngine.createGlideEngine()) // Please refer to the Demo GlideEngine.java

.forResult(PictureConfig.REQUEST_CAMERA);

@Override

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

super.onActivityResult(requestCode, resultCode, data);

if (resultCode == RESULT_OK) {

switch (requestCode) {

case PictureConfig.REQUEST_CAMERA:

// onResult Callback

List selectList = PictureSelector.obtainMultipleResult(data);

break;

default:

break;

}

}

Callback

PictureSelector.create(this)

.openCamera(PictureMimeType.ofImage())

.loadImageEngine(GlideEngine.createGlideEngine())

.forResult(new OnResultCallbackListener() {

@Override

public void onResult(List result) {

// onResult Callback

}

@Override

public void onCancel() {

// onCancel Callback

}

});

CustomCamera

If you need to use a custom camera you need to set up

.isUseCustomCamera(true);

Application implementing interface

public class App extends Application implements CameraXConfig.Provider {

private static final String TAG = App.class.getSimpleName();

@Override

public void onCreate() {

super.onCreate();

}

@NonNull

@Override

public CameraXConfig getCameraXConfig() {

return Camera2Config.defaultConfig();

}

}

CacheClear

// Include clipped and compressed cache, to be called upon successful upload, type refers to the image or video cache depending on which ofImage or ofVideo you set up note: system sd card permissions are required

PictureFileUtils.deleteCacheDirFile(this,type);

// Clear all temporary files generated by caching such as compression, clipping, video, and audio

PictureFileUtils.deleteAllCacheDirFile(this);

Preview Image

// Preview picture can be customized length press save path

*Prompt .themeStyle(R.style.theme);Inside the parameters can not be deleted, otherwise crash...

PictureSelector.create(this)

.themeStyle(R.style.picture_default_style)

.isNotPreviewDownload(true)

.loadImageEngine(GlideEngine.createGlideEngine())

.openExternalPreview(position, selectList);

Preview Video

PictureSelector.create(this).externalPictureVideo(video_path);

Project use libraries

PhotoView

luban

ucrop

Confusion

#PictureSelector 2.0

-keep class com.luck.picture.lib.** { *; }

#Ucrop

-dontwarn com.yalantis.ucrop**

-keep class com.yalantis.ucrop** { *; }

-keep interface com.yalantis.ucrop** { *; }

#Okio

-dontwarn org.codehaus.mojo.animal_sniffer.*

License

Copyright 2017 Luck

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.

Contact

Android Group 1 619458861 (biggest)

Android Group 2 679824206 (biggest)

Android Group 3 854136996 (biggest)

QQ 893855882

Effect

Single Mode

Mixed Mode

f79c07db8a5e4f40e138d18ed85ede40.png

cc8f692924503026d50896ae5a43d13c.png

Default Style

Preview

Multiple Crop

165287da52a91584c77400b7e158df2a.png

picture_default_style_2.jpg

1e7831c00447e65404953c36cfa9a068.png

Digital Style

Preview

Multiple Crop

d46d527a167d41fcc18936816c0998c3.png

77e33b2e6140e7b9160fa99b6d39cdfb.png

82ec260d18fefa7254d78c256b1c3f9f.png

White Style

Preview

Single Crop

c0cde8d83676d4fd4925b53438d8a0e4.png

picture_sina_style_new_2.jpg

picture_sina_style_new_3.jpg

New Style

Preview

Multiple Crop

picture_wechat_style_1.jpg

picture_wechat_style_2.jpg

picture_wechat_style_new_3.jpg

Photo Album Directory

Single Mode

Circular Crop

picture_wechat_album_style.jpg

picture_wechat_single_style_3.jpg

767df2f091e745a012d290a0392bccbb.png

White Style

Video

Audio

3b465f2a024a1070349872bd56f22260.png

1ec270500a746113c61db8253ec71f4a.png

4c254bf9684a62a6c431575c4198159b.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值