Matisse icon indicating copy to clipboard operation
Matisse copied to clipboard

在打开相册后,左上角切换其他相册,全部都是一片空白,只有刚进来的时候 全部相册才有内容!!!这个问题也太大了吧

Open Fudejun520 opened this issue 4 years ago • 16 comments

http://s.pz.com/u/8003/94/1/160049310359.jpg http://s.pz.com/u/8003/94/1/16004931036.jpg 请看截图

Fudejun520 avatar Sep 19 '20 05:09 Fudejun520

将Matisse的代码下载到本地,然后修改AlbumMediaLoader类中的ORDER_BY属性,改为:

private static final String ORDER_BY = MediaStore.Images.Media.DATE_MODIFIED+ " DESC";

也是无效的,特别急!

Fudejun520 avatar Sep 19 '20 05:09 Fudejun520

@Fudejun520 LZ解决了吗

ThugKd avatar Oct 24 '20 05:10 ThugKd

@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试

ThugKd avatar Oct 24 '20 08:10 ThugKd

@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试

可以了

jiayuan880123 avatar Oct 24 '20 08:10 jiayuan880123

@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试

这个在哪边改的?找了一遍没看到。

dogscar avatar Nov 27 '20 06:11 dogscar

@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试

可以了

这个在哪边改的?找了一遍没看到。

dogscar avatar Nov 27 '20 06:11 dogscar

@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试

可以了

这个在哪边改的?找了一遍没看到。

'androidx.appcompat:appcompat:1.3.0-alpha01'

ThugKd avatar Nov 27 '20 06:11 ThugKd

遇到同样的问题,个人解决方案: 在 MatisseActivity.onAlbumSelected 中将 replace fragment,改为 remove 和 add

private Fragment fragment;
private void onAlbumSelected(Album album) {
    if (album.isAll() && album.isEmpty()) {
        mContainer.setVisibility(View.GONE);
        mEmptyView.setVisibility(View.VISIBLE);
    } else {
        mContainer.setVisibility(View.VISIBLE);
        mEmptyView.setVisibility(View.GONE);
        if (fragment != null) {
            getSupportFragmentManager()
                    .beginTransaction()
                    .remove(fragment)
                    .commitAllowingStateLoss();
        }
        fragment = MediaSelectionFragment.newInstance(album);
        getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.container, fragment, MediaSelectionFragment.class.getSimpleName())
                .commitAllowingStateLoss();
    }
}

wangchenyan avatar Feb 26 '21 03:02 wangchenyan

我的 fork 版本 解决了这个问题,同时还修复一些其他问题,适配了新的 Result Api https://github.com/lwj1994/Matisse

lwj1994 avatar Feb 28 '21 09:02 lwj1994

androidx.fragment:fragment:1..3.0-alpha06 就是 这个问题,改成这个就行了

fail572872916 avatar Jul 28 '21 02:07 fail572872916

在MediaSelectionFragment的onActivityCreated方法里按下面的修改试试 mRecyclerView.post(() -> { mAlbumMediaCollection.onCreate(getActivity(), this); mAlbumMediaCollection.load(album, selectionSpec.capture); });

LyricGan avatar Jul 29 '21 10:07 LyricGan

我的是将 implementation 'androidx.appcompat:appcompat:1.3.0',退回 1.2.0 版本, 即:implementation 'androidx.appcompat:appcompat:1.2.0' 然后解决了问题。应该是androidx中的fragment库某个版本有问题。

RobotHost avatar Aug 19 '21 08:08 RobotHost

Encountered the same problem, personal solution: Change the replace fragment in MatisseActivity.onAlbumSelected to remove and add

private Fragment fragment;
private void onAlbumSelected(Album album) {
    if (album.isAll() && album.isEmpty()) {
        mContainer.setVisibility(View.GONE);
        mEmptyView.setVisibility(View.VISIBLE);
    } else {
        mContainer.setVisibility(View.VISIBLE);
        mEmptyView.setVisibility(View.GONE);
        if (fragment != null) {
            getSupportFragmentManager()
                    .beginTransaction()
                    .remove(fragment)
                    .commitAllowingStateLoss();
        }
        fragment = MediaSelectionFragment.newInstance(album);
        getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.container, fragment, MediaSelectionFragment.class.getSimpleName())
                .commitAllowingStateLoss();
    }
}

@wangchenyan Thanks

vickyappbull avatar Oct 12 '21 08:10 vickyappbull

看我的 PR: https://github.com/zhihu/Matisse/pull/863 更换 fragment 版本解决不了根本问题,后续如何兼容?问题是 livedata 监听的时候 onwer 的传递的问题,使用 fragment 而不是 activity 进行监听即可。

Shouheng88 avatar Oct 14 '21 10:10 Shouheng88

private Fragment fragment;

very nice

Julius-lq avatar Dec 27 '22 13:12 Julius-lq

就是 appcompat 依赖的问题 ,项目中有很多其他不同版本的依赖,最终打包的时候使用了高版本的导致此问题出现,将replace替换成 remove 和 add 非常完美的解决了这个问题

androidx.appcompat:appcompat:1.2.0

zkqueen avatar Apr 27 '23 07:04 zkqueen