Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Fudejun520 opened this issue Sep 19, 2020 · 16 comments

Comments

@Fudejun520
Copy link

Fudejun520 commented Sep 19, 2020

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

@Fudejun520
Copy link
Author

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

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

也是无效的,特别急!

@ThugKd
Copy link

ThugKd commented Oct 24, 2020

@Fudejun520 LZ解决了吗

@ThugKd
Copy link

ThugKd commented Oct 24, 2020

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

@jiayuan880123
Copy link

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

可以了

@dogscar
Copy link

dogscar commented Nov 27, 2020

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

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

@dogscar
Copy link

dogscar commented Nov 27, 2020

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

可以了

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

@ThugKd
Copy link

ThugKd commented Nov 27, 2020

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

@wangchenyan
Copy link

wangchenyan commented Feb 26, 2021

遇到同样的问题,个人解决方案:
在 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();
    }
}

@lwj1994
Copy link

lwj1994 commented Feb 28, 2021

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

@fail572872916
Copy link

fail572872916 commented Jul 28, 2021

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

@LyricGan
Copy link

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

@RobotHost
Copy link

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

@vickyappbull
Copy link

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

Shouheng88 pushed a commit to Shouheng88/Matisse that referenced this issue Oct 14, 2021
@Shouheng88
Copy link

Shouheng88 commented Oct 14, 2021

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

luketang3 added a commit to luketang3/Matisse that referenced this issue Feb 23, 2022
1.修复zhihu#812
lotosbin added a commit to lotosbin/Matisse that referenced this issue Mar 9, 2022
litang0908 added a commit to litang0908/Matisse that referenced this issue Jun 18, 2022
@Julius-lq
Copy link

private Fragment fragment;

very nice

@zkqueen
Copy link

zkqueen commented Apr 27, 2023

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

androidx.appcompat:appcompat:1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests