GithubHelp home page GithubHelp logo

donglua / photopicker Goto Github PK

View Code? Open in Web Editor NEW
2.8K 94.0 684.0 629 KB

[DEPRECATED] Image Picker like Wechat

Home Page: https://play.google.com/store/apps/details?id=me.iwf.PhotoPickerDemo

License: Apache License 2.0

Java 99.60% Shell 0.40%
photopicker imagepicker

photopicker's Introduction

PhotoPicker

CircleCI Build Status Android Arsenal Download API


DEPRECATED

PhotoPicker is deprecated.

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

Example

Get it on Google Play


Usage

Gradle

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

eclipse

[GO HOME

Pick Photo

PhotoPicker.builder()
    .setPhotoCount(9)
    .setShowCamera(true)
    .setShowGif(true)
    .setPreviewEnabled(false)
    .start(this, PhotoPicker.REQUEST_CODE);

Preview Photo

ArrayList<String> photoPaths = ...;

PhotoPreview.builder()
    .setPhotos(selectedPhotos)
    .setCurrentItem(position)
    .setShowDeleteButton(false)
    .start(MainActivity.this);

onActivityResult

@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

<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>

Custom style

<style name="actionBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
  <item name="android:textColorPrimary">@android:color/primary_text_light</item>
  <item name="actionBarSize">@dimen/actionBarSize</item>
</style>

<style name="customTheme" parent="Theme.AppCompat.Light.NoActionBar">
  <item name="actionBarTheme">@style/actionBarTheme</item>
  <item name="colorPrimary">#FFA500</item>
  <item name="actionBarSize">@dimen/actionBarSize</item>
  <item name="colorPrimaryDark">#CCa500</item>
</style>

Proguard

# 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$* { *; }

License

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.

photopicker's People

Contributors

aanikolaev avatar bitdeli-chef avatar cai-peiyuan avatar chowaikong avatar donglua avatar dwkim-sugarhill avatar elevenfive avatar flyntcat1 avatar gjiazhe avatar hortongou avatar jankin6 avatar liaohuqiu avatar liuguangli avatar lukmanu avatar pedrofsn avatar qwert2603 avatar sangcomz avatar sheungon avatar tinybright avatar xingstarx avatar yemengsky avatar yunxuanyan avatar zhudongya123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

photopicker's Issues

Disable viewing images

How can I disable clicking on images to view them? everytime I try choosing an image by clicking on the checkbox, I end up opening the image instead (which in my point of view is not very usable)

Change Language

Hello,

I import this library using Gradle, how can I change the string inside the library to traditional chinese?
Thank You

查看图片问题

查看某些图片的时候图片会显示在scrollview的底部而不是居中显示,这样会造成一下子看不全的问题

gradle配置了0.2.8版本之后,没有配置删除按钮的功能

图片上传不上来,把代码贴上来好了
public class PhotoPagerActivity extends AppCompatActivity {
private ImagePagerFragment pagerFragment;
public static final String EXTRA_CURRENT_ITEM = "current_item";
public static final String EXTRA_PHOTOS = "photos";
private ActionBar actionBar;
没有EXTRA_SHOW_DELETE

预览大图,内存暴涨,无法释放

在选择图片时,点击一张图片查看大图,内存暴涨了近40M,关闭选择器,内存没有被释放

机器是Android原生5.1

========================预览之前
qq20160421-0

========================预览
qq20160421-1

点击相机报错

06-16 10:19:00.176 1220-1220/me.iwf.PhotoPickerDemo W/System.err: java.io.IOException: open failed: EACCES (Permission denied)
06-16 10:19:00.178 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at java.io.File.createNewFile(File.java:941)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at java.io.File.createTempFile(File.java:1006)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at me.iwf.photopicker.utils.ImageCaptureManager.createImageFile(ImageCaptureManager.java:44)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at me.iwf.photopicker.utils.ImageCaptureManager.dispatchTakePictureIntent(ImageCaptureManager.java:61)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at me.iwf.photopicker.fragment.PhotoPickerFragment$4.onClick(PhotoPickerFragment.java:158)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at me.iwf.photopicker.adapter.PhotoGridAdapter$1.onClick(PhotoGridAdapter.java:79)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at android.view.View.performClick(View.java:4909)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at android.view.View$PerformClick.run(View.java:20390)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at android.os.Handler.handleCallback(Handler.java:815)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at android.os.Handler.dispatchMessage(Handler.java:104)
06-16 10:19:00.179 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at android.os.Looper.loop(Looper.java:194)
06-16 10:19:00.184 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5803)
06-16 10:19:00.184 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at java.lang.reflect.Method.invoke(Native Method)
06-16 10:19:00.184 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
06-16 10:19:00.184 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1010)
06-16 10:19:00.184 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
06-16 10:19:00.184 1220-1220/me.iwf.PhotoPickerDemo W/System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
06-16 10:19:00.185 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at libcore.io.Posix.open(Native Method)
06-16 10:19:00.185 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
06-16 10:19:00.185 1220-1220/me.iwf.PhotoPickerDemo W/System.err: at java.io.File.createNewFile(File.java:934)
06-16 10:19:00.185 1220-1220/me.iwf.PhotoPickerDemo W/System.err: ... 15 more

Not working with Marshmallow

As Marshmallow need to give permission, I have added Permission Checker code too, still I am getting problem to when trying to open Camera:

Error : open failed: EACCES (Permission denied)

I had taken following permission also:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Is there any solution?

REQUEST_CODE自定义

更新到最新的0.8.3,发现REQUEST_CODE无法自定义了,变成了固定的233.

有这样的业务场景,一个页面有多处要选择图片的地方(不确定具体个数),用循环为每个地方绑定一个点击选择图片的事件,用的是各自唯一的REQUEST_CODE(使用随机值,生成并维护起来),这样在onActivityResult中就可以区分出是哪边点击了,图片可以显示到该显示的地方。

现在新版固定了REQUEST_CODE,在这种场景下,无法满足需求

大容量图片无法预览

0.2.8版预览本地相机(1300w)拍的照片时失败,Glide抛尺寸过大异常,0.2.6版则能预览

希望加入对网络图片预览的支持

使用此组件进行图片选择并发布内容后,再次编辑时,内容图片都是从网络上加载以供编辑的,这时图片预览组件就没法使用了

图片无法预览的bug

31问题出现的几率小了,但依旧存在,目前只在4.1.2的lt26i上重现了。

现在的问题主要是,用上述机器打开图片选择器,不做任何操作,待缩略图加载完毕,点击一张图片,预览页可能显示出这张图片,也可能一直显示默认图片(如下图),无法预览

lt26i_1257-77636 2 b 1 96jwu08312015143736

pic from camera

when pick from camera i won't The image will not will be saved on the device

建议:拍照获取的照片默认选中

Thanks for this great work

提个建议:
对于图片多选择情况下,如果选择摄像头拍照,拍照后得到的照片,建议默认就是选中状态。
如果是单张图片,建议直接返回图片结果

另外如果选中照片到达max后,可以限制不让点击拍照或者拍照后返回的照片不再选中。

Showing all images

Hi, the library have a bug, it doesn't show me all images but few images

French translation(resolved)

Hello , is it possible to change the "done" text and "all image" text ? I need them in French or better be able to change them.
Thanks.
Great library by the way.

Never mind found it 👍
I've added this to my strings.xml

<string name="all_image">Voir plus</string>
    <string name="images">Retour</string>
    <string name="done">Ok</string>

Removing Text At Bottom Of Camera Icon

The examle on Google Play Sote have no text at bottom of camera icon.
But in my application there is a text at bottom of camera icon. I could not able to change or remove it.
Thanks.
screen shot 2016-05-04 at 14 55 25

Folder chooser

Hello. Your library is great! Thank you.

Issue I have is with the "ALL IMAGE" folder chooser.
It repeats "ALL IMAGE", and "Pictures" for each taken picture. (After photo is taken from the camera)

i.e.

All image
All Image
All Image
Pictures
All Image
Pictures
All Image
Pictures
etc..

NoSuchMethodError依然重现

java.lang.NoSuchMethodError: No virtual method getContext()Landroid/content/Context; in class Lme/iwf/photopicker/fragment/PhotoPickerFragment; or its super classes (declaration of 'me.iwf.photopicker.fragment.PhotoPickerFragment' appears in /data/app/com.nake.app-1/base.apk)

two bugs

  • 选择图片后点击已经选择的图片查看详细,此时点击右上角的删除按钮,然后点击back退出查看详细页面,该图片仍旧存在。 只能通过点击删除后点击页面左上角的箭头退出才可删除成功。
  • 崩溃问题,经测试,在删除 9/9,8/9,8/8,7/7 这四张图时会出现崩溃问题

6.0调用PhotoPickerIntent开启PhotoPickerActivity页面崩溃

I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
I/HwCust: Constructor found for class android.widget.HwCustTextViewImpl
I/Process: Sending signal. PID: 13914 SIG: 9
I/HwCust: Constructor found for class android.widget.HwCustTextViewImpl
I/HwCust: Constructor found for class android.widget.HwCustTextViewImpl
E/HAL: load: id=gralloc != hmi->id=gralloc
E/HAL: load: id=gralloc != hmi->id=gralloc
I/OpenGLRenderer: Initialized EGL, version 1.4
W/OpenGLRenderer: load: so=/system/lib64/libhwuibp.so
dlopen failed: library "/system/lib64/libhwuibp.so" not found
W/OpenGLRenderer: Initialize Binary Program Cache: Load Failed
E/HAL: load: id=gralloc != hmi->id=gralloc

手机是6.0的华为荣耀,别的手机没试过

图片无法预览的bug

第一次进入图片选择器时,快速向下滑动,点击一张还未显示缩略图的图片,打开了预览页,但是不显示图片,界面一直处于半透明的状态,透过页面看到当前可见页面的缩略图加载完成后,此时某些机型能显示出当前打开的图片,某些机型则还是处于半透明状态,一直不显示要预览的图片。这种情况下,即便关掉图片选择器,再次打开,刚刚那些无法预览的图片依旧点开是半透明,无法预览。

Select Single Photo

When setPhotoCount is 1:

An image is selected (DONE message appears),
the image is unselected (DONE message disappears) <-- but check mark is still visible.

何时刷新图库的问题

1、在拍完照回来返回选图时,所有图库的列表会增加拍照的图片,但是Picture文件夹中并没有增加,这里应该少了相应路径list的新增图片滤镜;
2、如果在选图界面点击home键返回桌面,但不退出该应用。如果使用系统相机或者其他相机拍照后,再切换回应用的选图界面,图片列表并不会实时更新。需要退出后,重新加载一次这个PhotoPickerActivity,再去扫图才能显示出来。所以是否有更好的刷新图库的方案?

可以移除无用的资源文件ic_launcher.png吗?

可以移除无用的资源文件ic_launcher.png吗?

因为会导致资源文件冲突,ic_launcher.png: Original is here.

主工程的ic_launcher.png可以重命名,但是其他第三方类库也没有移除ic_launcher.png,就比较难解决了。所以帮忙移除一下ic_launcher.png

Gif

Hi, thank you very much for this amazing lib. Please how can I select a gif ?

加载动态图编译报错

编译的时候直接报错

Exception failed for task ':app:transformClassedWithJarMergingFor_DebugDebug'.

com.android.build.api.transform.TransformException:java.util.zip.ZipException:duplicate entry: com/bumptech/glide/gifdecoder/GifDecoder$BitmapProvider.class

然后把Glide那个三方插件给移除后可以编译通过

应该是加载动态图那里有点儿问题,求donglua哥给解答下。

Runtime Exception

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rinc.ruprise.r, PID: 18888
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rinc.ruprise.r/me.iwf.photopicker.PhotoPickerActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
at android.app.ActivityThread.access$900(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5511)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at me.iwf.photopicker.PhotoPickerActivity.onCreate(PhotoPickerActivity.java:53)
at android.app.Activity.performCreate(Activity.java:5322)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2303)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391) 
at android.app.ActivityThread.access$900(ActivityThread.java:166) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5511) 
at java.lang.reflect.Method.invokeNative(Native

相册重复问题

我发现使用该库会出现很多重复的相册;对比的微信的图片选择他会把相同名称的相册合并,于是乎猜测作者没有过滤相同名字的相册;不过看了代码作者还是比较了,但是仍然有大量相同的名字的相册没有合并;发现原来是me.iwf.photopicker.entity.PhotoDirectory.java实体类中,重写的equal方法也加入了id的比较,修改equal方法只对name进行比较;改过之后和微信相册基本一致,希望作者修复;

hi

非常实用!谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.