AndroidPicturePicker
Introduction: 基于 Laevatein 扩展的图片选择器,可以让开发者自由选择图片加载库,比如可配置为 Picasso,Glide,Android-Universal-Image-Loader,也可以自定义图片加载库,只需实现 Engine 接口即可。支持第一个 item 为相机拍照,支持多选,单选。后期正在扩展是否可以预览图片,图片选择类型,图片尺寸过滤。
Tags:
图片选择器-Picker-Thanks for :
Laevatein:Photo image selection activity set library. Currently under development.
Picasso:A powerful image downloading and caching library for Android
Glide:An image loading and caching library for Android focused on smooth scrolling
Android-Universal-Image-Loader:Powerful and flexible library for loading, caching and displaying images on Android.
Screen Shot
Usage
Call photo image selection activity by the following code snipet.
public void onClickButton(View view) {
Picker.from(this)
.count(3)
.enableCamera(true)
.setEngine(new GlideEngine())
.forResult(REQUEST_CODE_CHOOSE);
}
You can use different Image Loader, Picker provide 3 default Loader Engine:
1.GlideEngine
2.PicassoEngine
3.ImageLoaderEngine
or you can use custom engine , just like
public static class CustomEngine implements LoadEngine {
@Override
public void displayImage(String path, ImageView imageView) {
Log.i("picture", path);
}
@Override
public void displayCameraItem(ImageView imageView) {
}
@Override
public void scrolling(GridView view) {
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
public CustomEngine() {
}
protected CustomEngine(Parcel in) {
}
public static final Creator<CustomEngine> CREATOR = new Creator<CustomEngine>() {
public CustomEngine createFromParcel(Parcel source) {
return new CustomEngine(source);
}
public CustomEngine[] newArray(int size) {
return new CustomEngine[size];
}
};
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) {
mSelected = PicturePickerUtils.obtainResult(data);
for (Uri u : mSelected) {
Log.i("picture", u.getPath());
}
}
}
Please note that LoadEngine is extends Parcelable.
Download
Gradle
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.valuesfeng:androidpicturepicker:1.0.0'
}
wait achieve
help me……
License
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.