mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 15:17:42 +03:00
Sort items on FileSelectionScreen
This commit is contained in:
parent
6d3d25a288
commit
021f77eab3
@ -3,6 +3,14 @@
|
|||||||
#include <EpdRenderer.h>
|
#include <EpdRenderer.h>
|
||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
|
|
||||||
|
void caseInsensitiveSort(std::vector<std::string>& strs) {
|
||||||
|
std::sort(begin(strs), end(strs), [](const std::string& str1, const std::string& str2) {
|
||||||
|
return lexicographical_compare(
|
||||||
|
begin(str1), end(str1), begin(str2), end(str2),
|
||||||
|
[](const char& char1, const char& char2) { return tolower(char1) < tolower(char2); });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void FileSelectionScreen::taskTrampoline(void* param) {
|
void FileSelectionScreen::taskTrampoline(void* param) {
|
||||||
auto* self = static_cast<FileSelectionScreen*>(param);
|
auto* self = static_cast<FileSelectionScreen*>(param);
|
||||||
self->displayTaskLoop();
|
self->displayTaskLoop();
|
||||||
@ -27,6 +35,7 @@ void FileSelectionScreen::loadFiles() {
|
|||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
root.close();
|
root.close();
|
||||||
|
caseInsensitiveSort(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSelectionScreen::onEnter() {
|
void FileSelectionScreen::onEnter() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user