GithubHelp home page GithubHelp logo

Comments (9)

donglua avatar donglua commented on July 27, 2024

其实也没多少个依赖,有三个是android官方的库,把另外两个的jar包引入就可以了。

from photopicker.

wangkunlin avatar wangkunlin commented on July 27, 2024

我跑了一下你的demo发现几个问题:
1、选择图片过程中,点击手机的物理menu按键弹出一个 完成(x/x),然后点返回,然后再勾选图片,发现右上角的数字不会增长了。
2、选择完图片后,在结果界面进入浏览,点击最后一张的删除,程序崩溃,估计是越界了。
3、点击拍照,完成拍照后,选择相册的listview数量增多1倍有时2倍。

from photopicker.

donglua avatar donglua commented on July 27, 2024

第1个bug我刚改了,另外两个没能重现,请问是什么机型

from photopicker.

donglua avatar donglua commented on July 27, 2024

menu的问题是因为点击menu按钮的时候又调了一次onCreateOptionsMenu,导致拿到的完成按钮变成了新弹出的那一个~

from photopicker.

wangkunlin avatar wangkunlin commented on July 27, 2024

我的手机是一加

from photopicker.

wangkunlin avatar wangkunlin commented on July 27, 2024

当拍照完成后会触发

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.

wangkunlin avatar wangkunlin commented on July 27, 2024

崩溃的问题我看了一下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.

donglua avatar donglua commented on July 27, 2024

我更新了一个版本,修复了以上问题,试下

from photopicker.

wangkunlin avatar wangkunlin commented on July 27, 2024

ok 我更新下 看看

from photopicker.

Related Issues (20)

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.