wqandroid / wqgallery

android 相册支持单选模式和多选模式
432 stars 116 forks source link

在三星sm-n9008 中照相不显示选择不到图片问题. #12

Open zjackcoder opened 8 years ago

zjackcoder commented 8 years ago

该三星手机在照相机启动时候 会导致 app 被强制横屏导致 activity 里面的一些变量为空...

wqandroid commented 8 years ago

你的手机是不是自动旋转开了。 你如果着急用的话,可以吧代码下载下来,在manifest里面指定activity 的横竖屏幕,我回头去修复这个bug

zjackcoder commented 8 years ago

那个是强制横屏的 就算在manifest 里面配置还是会被横竖屏幕切换,简单使用savedInstanceState保存currentfile 也没什么用,activity 重启了两次 导致MediaScannerConnection还没扫描完activity 就关闭了,,服务泄漏了 `3-17 15:01:47.133 9994-9994/com.eq.gallery I/gallery: onCreate~~~~ 03-17 15:01:47.163 9994-9994/com.eq.gallery I/gallery: /storage/emulated/0/DCIM/IMG_20160317150130.jpg 03-17 15:01:47.253 9994-11290/com.eq.gallery E/TAG: 71 03-17 15:01:47.283 9994-11295/com.eq.gallery E/TAG: 71 03-17 15:01:48.163 9994-9994/com.eq.gallery I/Choreographer: Skipped 63 frames! The application may be doing too much work on its main thread. 03-17 15:01:48.243 9994-9994/com.eq.gallery I/gallery: onSaveInstanceState~~ 03-17 15:01:48.273 9994-9994/com.eq.gallery I/gallery: onCreate~~~~ 03-17 15:01:48.303 9994-9994/com.eq.gallery I/gallery: /storage/emulated/0/DCIM/IMG_20160317150130.jpg 03-17 15:01:48.323 9994-11317/com.eq.gallery E/TAG: 72 03-17 15:01:48.333 9994-11318/com.eq.gallery E/TAG: 73 03-17 15:01:48.363 9994-11319/com.eq.gallery E/TAG: 73 03-17 15:01:48.433 9994-9994/com.eq.gallery E/ViewRootImpl: sendUserActionEvent() mView == null 03-17 15:01:48.433 9994-9994/com.eq.gallery E/ViewRootImpl: sendUserActionEvent() mView == null 03-17 15:01:48.443 9994-9994/com.eq.gallery E/ActivityThread: Activity com.wq.photo.MediaChoseActivity has leaked ServiceConnection android.media.MediaScannerConnection@32af392c that was originally bound here android.app.ServiceConnectionLeaked: Activity com.wq.photo.MediaChoseActivity has leaked ServiceConnection android.media.MediaScannerConnection@32af392c that was originally bound here at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:1134) at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1028) at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:2155) at android.app.ContextImpl.bindService(ContextImpl.java:2138) at android.content.ContextWrapper.bindService(ContextWrapper.java:559) at android.media.MediaScannerConnection.connect(MediaScannerConnection.java:119) at android.media.MediaScannerConnection.scanFile(MediaScannerConnection.java:238) at com.wq.photo.MediaChoseActivity.insertImage(MediaChoseActivity.java:301) at com.wq.photo.MediaChoseActivity.onActivityResult(MediaChoseActivity.java:284) at android.app.Activity.dispatchActivityResult(Activity.java:6548) at android.app.ActivityThread.deliverResults(ActivityThread.java:4054) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3380) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3425) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2763) at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4462) at android.app.ActivityThread.access$1000(ActivityThread.java:177) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1454) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5942) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

wqandroid commented 8 years ago

你的手机是4.几的系统?我的s6是没有这个问题的

zjackcoder commented 8 years ago

手机 android 5.0

wqandroid commented 8 years ago

我已经解决了那个问题,发布了3.1.0 你改一下版本号 应该就ok了!谢谢你的反馈

wqandroid commented 8 years ago

compile 'com.github.wqandroid:wqgallery:3.1.0'

zjackcoder commented 8 years ago

谢谢,,可以用了

zjackcoder commented 8 years ago

再改一下就完美了

在PhotoGalleryFragment,159行改成

handler.post(new Runnable() { @Override public void run() { currentimageses.add(0, path); imageses.add(0, path); adapter.notifyDataSetChanged(); } });

在PhotoAdapter 类的getitem方法改成下面:

public String getItem(int postion) { int realPos = postion; if (isNeedCamera){ realPos = postion -1; } if (realPos >= imageses.size()) return ""; return imageses.get(realPos); }

wqandroid commented 8 years ago

已采纳谢谢