####选择一张图片时可以设置裁剪 PhotoPicker.builder() .setPhotoCount(1) .setShowCamera(true) .setShowGif(true) .circleClip()//圆形裁剪 clip()为矩形裁剪,多张图片此方法调用无效 .setPreviewEnabled(false) .start(this, PhotoPicker.REQUEST_CODE);
### Preview Photo
```java
ArrayList<String> photoPaths = ...;
PhotoPreview.builder()
.setPhotos(selectedPhotos)
.setCurrentItem(position)
.setShowDeleteButton(false)
.start(MainActivity.this);
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == PhotoPicker.REQUEST_CODE) {
if (data != null) {
ArrayList<String> photos =
data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
}
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA" />
<application
...
>
...
<activity android:name="me.iwf.photopicker.PhotoPickerActivity"
android:theme="@style/Theme.AppCompat.NoActionBar"
/>
<activity android:name="me.iwf.photopicker.PhotoPagerActivity"
android:theme="@style/Theme.AppCompat.NoActionBar"/>
</application>
</manifest>
<style name="actionBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColorPrimary">@android:color/primary_text_light</item>
</style>
<style name="photoPickerTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="actionBarTheme">@style/actionBarTheme</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:textColorPrimary">@android:color/white</item>
</style>
# Glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
# support-v7-appcompat
-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }
-keep public class * extends android.support.v4.view.ActionProvider {
public <init>(android.content.Context);
}
# support-design
-dontwarn android.support.design.**
-keep class android.support.design.** { *; }
-keep interface android.support.design.** { *; }
-keep public class android.support.design.R$* { *; }
Copyright 2015 Huang Donglu
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.