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

排序与系统相册不一致 #858

Closed
erleizh opened this issue Jun 25, 2021 · 4 comments
Closed

排序与系统相册不一致 #858

erleizh opened this issue Jun 25, 2021 · 4 comments

Comments

@erleizh
Copy link

erleizh commented Jun 25, 2021

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

在某些手机上,相册里面的排序有问题,新增一张图片但是排在最后面 ,例如小米9

貌似无人维护了,不过还是贴在这里一个解决方案吧

    //https://android.googlesource.com/platform/packages/apps/Gallery/+/refs/heads/android10-mainline-a-release/src/com/android/camera/gallery/BaseImageList.java
    // 列表首先按日期排序,然后按 id 排序。
    // 日期是从“datetaken”列中获取的。 但如果它为空,
    // 改为使用“date_modified”列。
    public static final String ORDER_BY =
            "case ifnull(" + MediaStore.Images.Media.DATE_TAKEN + ",0)" +
                    " when 0 then " + MediaStore.Images.Media.DATE_MODIFIED + "*1000" +
                    " else " + MediaStore.Images.Media.DATE_TAKEN +
                    " end" + " DESC , " + MediaStore.Images.ImageColumns._ID + " DESC";
moodcal pushed a commit to moodcal/Matisse that referenced this issue Sep 7, 2021
@bailyzheng
Copy link

按此方法已解决我的问题

@itsscdachao
Copy link

此方法可以解决

@hxkdidi
Copy link

hxkdidi commented Jul 5, 2022

华为HONOR 50 安卓11 不起作用

@kongnanlive
Copy link

华为HONOR 50 安卓11 不起作用

解决了吗?

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

5 participants