Comments (9)
其实也没多少个依赖,有三个是android官方的库,把另外两个的jar包引入就可以了。
from photopicker.
我跑了一下你的demo发现几个问题:
1、选择图片过程中,点击手机的物理menu按键弹出一个 完成(x/x),然后点返回,然后再勾选图片,发现右上角的数字不会增长了。
2、选择完图片后,在结果界面进入浏览,点击最后一张的删除,程序崩溃,估计是越界了。
3、点击拍照,完成拍照后,选择相册的listview数量增多1倍有时2倍。
from photopicker.
第1个bug我刚改了,另外两个没能重现,请问是什么机型
from photopicker.
menu的问题是因为点击menu按钮的时候又调了一次onCreateOptionsMenu,导致拿到的完成按钮变成了新弹出的那一个~
from photopicker.
我的手机是一加
from photopicker.
当拍照完成后会触发
public void galleryAddPic() {
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
File f = new File(mCurrentPhotoPath);
Uri contentUri = Uri.fromFile(f);
mediaScanIntent.setData(contentUri);
mContext.sendBroadcast(mediaScanIntent);
}
而在PhotoPickerFragment中有这样一段代码,
MediaStoreHelper.getPhotoDirs(getActivity(),
new MediaStoreHelper.PhotosResultCallback() {
@Override public void onResultCallback(List<PhotoDirectory> directories) {
photoGridAdapter.notifyDataSetChanged();
PhotoPickerFragment.this.directories.addAll(directories);
listAdapter.notifyDataSetChanged();
}
});
我发现,这段代码不光启动PhotoPickerFragment时会执行,在执行完成扫面图片广播够也会被触发,所以我断定是在这个地方导致了相册数以及图片翻倍,我把你的代码移植过来后加了如下判断
if (PhotoPickerFragment.this.directories.size() > 0) {
PhotoPickerFragment.this.directories.clear();
}
就没有发生重复的现象。
from photopicker.
崩溃的问题我看了一下log
java.lang.NullPointerException
at android.view.ViewGroup.removeViewInternal(ViewGroup.java:3837)
at android.view.ViewGroup.removeViewAt(ViewGroup.java:3801)
at me.iwf.photopicker.PhotoPagerActivity.onOptionsItemSelected(PhotoPagerActivity.java:123)
其中第123行代码是
if (pagerFragment.getPaths().size() <= 1) {
......
} else {
snackbar.show();
pagerFragment.getPaths().remove(index);
pagerFragment.getViewPager().removeViewAt(index); // 123
pagerFragment.getViewPager().getAdapter().notifyDataSetChanged();
}
我刚才又试了一下,如果删除倒数第二张,则会跳到最后一张,此时点删除没问题,如果直接删除最后一张,就崩溃了。
from photopicker.
我更新了一个版本,修复了以上问题,试下
from photopicker.
ok 我更新下 看看
from photopicker.
Related Issues (20)
- 拍摄照片结束后,直接加载图片,不用进图库页面 HOT 1
- java.lang.NoSuchMethodError:
- 如何取消所有已选图片?
- Unable to get provider me.iwf.photopicker.utils.PhotoFileProvider
- Auto select after taking picture
- 选择图片是否可以只有指定路径的图片
- 拍照页面不点击拍照,点击返回,图片信息为空 HOT 2
- 图片选择界面在熄屏后再解锁,全部图片消失
- 现在0.9.12版本只能与glide4.1.1一起使用。 HOT 2
- Getting images uri
- anr 异常 HOT 1
- 想加载gif图片,怎么改造?
- 预览的时候打开删除按钮后点击删除就报错,只有关闭才能使用
- 下了你的工程,用了glide4.8后,发现图片显示是上一次拍的照片 HOT 4
- android9.0手机拍照崩溃
- Create duplicate images
- 预览时支持图片/视频混合吗 HOT 1
- 安卓Q刷新问题
- 挑选图片格式不支持HEIC
- 大佬再见
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from photopicker.