项目作者: donglua

项目描述 :
[DEPRECATED] Image Picker like Wechat
高级语言: Java
项目地址: git://github.com/donglua/PhotoPicker.git
创建时间: 2015-06-25T16:53:50Z
项目社区:https://github.com/donglua/PhotoPicker

开源协议:Apache License 2.0

下载


PhotoPicker

CircleCI
Build Status
Android Arsenal
Download
API


DEPRECATED

PhotoPicker is deprecated.

  • 本项目已废弃,仍可使用,但不推荐;推荐使用 zhihu/Matisse
  • 本项目建于2015年初,是最早的图片选择库之一。由于目前同类开源项目很多,也做得更完善,加上迁移成本低,本项目没有继续维护的必要,感谢大家支持。

Example





Get it on Google Play


Usage

Gradle

  1. dependencies {
  2. compile 'me.iwf.photopicker:PhotoPicker:0.9.12@aar'
  3. compile 'com.android.support:appcompat-v7:23.4.0'
  4. compile 'com.android.support:recyclerview-v7:23.4.0'
  5. compile 'com.android.support:design:23.4.0'
  6. compile 'com.github.bumptech.glide:glide:4.1.1'
  7. }
  • appcompat-v7version >= 23.0.0

eclipse

[GO HOME

Pick Photo

  1. PhotoPicker.builder()
  2. .setPhotoCount(9)
  3. .setShowCamera(true)
  4. .setShowGif(true)
  5. .setPreviewEnabled(false)
  6. .start(this, PhotoPicker.REQUEST_CODE);

Preview Photo

  1. ArrayList<String> photoPaths = ...;
  2. PhotoPreview.builder()
  3. .setPhotos(selectedPhotos)
  4. .setCurrentItem(position)
  5. .setShowDeleteButton(false)
  6. .start(MainActivity.this);

onActivityResult

  1. @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  2. super.onActivityResult(requestCode, resultCode, data);
  3. if (resultCode == RESULT_OK && requestCode == PhotoPicker.REQUEST_CODE) {
  4. if (data != null) {
  5. ArrayList<String> photos =
  6. data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
  7. }
  8. }
  9. }

manifest

  1. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  2. >
  3. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
  4. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
  5. <uses-permission android:name="android.permission.CAMERA" ></uses-permission>
  6. <application
  7. ...
  8. >
  9. ...
  10. <activity android:name="me.iwf.photopicker.PhotoPickerActivity"
  11. android:theme="@style/Theme.AppCompat.NoActionBar"
  12. ></activity>
  13. <activity android:name="me.iwf.photopicker.PhotoPagerActivity"
  14. android:theme="@style/Theme.AppCompat.NoActionBar"></activity>
  15. </application>
  16. </manifest>

Custom style

  1. <style name="actionBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
  2. <item name="android:textColorPrimary">@android:color/primary_text_light</item>
  3. <item name="actionBarSize">@dimen/actionBarSize</item>
  4. </style>
  5. <style name="customTheme" parent="Theme.AppCompat.Light.NoActionBar">
  6. <item name="actionBarTheme">@style/actionBarTheme</item>
  7. <item name="colorPrimary">#FFA500</item>
  8. <item name="actionBarSize">@dimen/actionBarSize</item>
  9. <item name="colorPrimaryDark">#CCa500</item>
  10. </style>

Proguard

  1. # Glide
  2. -keep public class * implements com.bumptech.glide.module.GlideModule
  3. -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  4. **[] $VALUES;
  5. public *;
  6. }
  7. # support-v7-appcompat
  8. -keep public class android.support.v7.widget.** { *; }
  9. -keep public class android.support.v7.internal.widget.** { *; }
  10. -keep public class android.support.v7.internal.view.menu.** { *; }
  11. -keep public class * extends android.support.v4.view.ActionProvider {
  12. public <init>(android.content.Context);
  13. }
  14. # support-design
  15. -dontwarn android.support.design.**
  16. -keep class android.support.design.** { *; }
  17. -keep interface android.support.design.** { *; }
  18. -keep public class android.support.design.R$* { *; }

License

  1. Copyright 2015 Huang Donglu
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.