|
1 | 1 | # AndroidPicturePicker |
2 | 2 |
|
3 | | -## Usage |
| 3 | + |
| 4 | +##Thanks for : |
| 5 | +[Laevatein](https://github.com/nohana/Laevatein):Photo image selection activity set library. Currently under development. |
| 6 | +[Picasso](https://github.com/square/picasso):A powerful image downloading and caching library for Android |
| 7 | +[Glide](https://github.com/bumptech/glide):An image loading and caching library for Android focused on smooth scrolling |
| 8 | +[Android-Universal-Image-Loader](https://github.com/nostra13/Android-Universal-Image-Loader):Powerful and flexible library for loading, caching and displaying images on Android. |
| 9 | + |
| 10 | +##Screen Shot |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +## Usage |
| 16 | + |
| 17 | +Call photo image selection activity by the following code snipet. |
| 18 | +```java |
| 19 | +public void onClickButton(View view) { |
| 20 | + Picker.from(this) |
| 21 | + .count(3) |
| 22 | + .enableCamera(true) |
| 23 | + .setEngine(new GlideEngine()) |
| 24 | + .forResult(REQUEST_CODE_CHOOSE); |
| 25 | + } |
| 26 | +``` |
| 27 | +You can use different Image Loader, Picker provide 3 Loader Engine: |
| 28 | +1.GlideEngine |
| 29 | +2.PicassoEngine |
| 30 | +3.ImageLoaderEngine |
| 31 | + |
| 32 | +or you can use custom engine , just like: |
| 33 | + |
| 34 | + public static class CustomEngine implements LoadEngine { |
| 35 | + |
| 36 | + @Override |
| 37 | + public void displayImage(String path, ImageView imageView) { |
| 38 | + Log.i("picture", path); |
| 39 | + } |
| 40 | + |
| 41 | + @Override |
| 42 | + public void displayCameraItem(ImageView imageView) { |
| 43 | + |
| 44 | + } |
| 45 | + |
| 46 | + @Override |
| 47 | + public void scrolling(GridView view) { |
| 48 | + |
| 49 | + } |
| 50 | + |
| 51 | + @Override |
| 52 | + public int describeContents() { |
| 53 | + return 0; |
| 54 | + } |
| 55 | + |
| 56 | + @Override |
| 57 | + public void writeToParcel(Parcel dest, int flags) { |
| 58 | + } |
| 59 | + |
| 60 | + public CustomEngine() { |
| 61 | + |
| 62 | + } |
| 63 | + |
| 64 | + protected CustomEngine(Parcel in) { |
| 65 | + } |
| 66 | + |
| 67 | + public static final Creator<CustomEngine> CREATOR = new Creator<CustomEngine>() { |
| 68 | + public CustomEngine createFromParcel(Parcel source) { |
| 69 | + return new CustomEngine(source); |
| 70 | + } |
| 71 | + |
| 72 | + public CustomEngine[] newArray(int size) { |
| 73 | + return new CustomEngine[size]; |
| 74 | + } |
| 75 | + }; |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 80 | + super.onActivityResult(requestCode, resultCode, data); |
| 81 | + if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) { |
| 82 | + mSelected = PicturePickerUtils.obtainResult(data); |
| 83 | + for (Uri u : mSelected) { |
| 84 | + Log.i("picture", u.getPath()); |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +Please note that LoadEngine is extends Parcelable. |
| 92 | + |
| 93 | +##Download |
| 94 | +Gradle |
4 | 95 | ```gradle |
5 | 96 | repositories { |
6 | 97 | maven { url "https://jitpack.io" } |
|
11 | 102 | compile 'com.github.ValuesFeng:AndroidPicturePicker:1.0_alpha' |
12 | 103 | } |
13 | 104 | ``` |
| 105 | + |
| 106 | +##License |
| 107 | + |
| 108 | + |
| 109 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 110 | + you may not use this file except in compliance with the License. |
| 111 | + You may obtain a copy of the License at |
| 112 | + |
| 113 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 114 | + |
| 115 | + Unless required by applicable law or agreed to in writing, software |
| 116 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 117 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 118 | + See the License for the specific language governing permissions and |
| 119 | + limitations under the License. |
| 120 | + |
| 121 | + |
| 122 | + |
0 commit comments