Skip to content

Commit 543106e

Browse files
Refactor: Improve app list sorting
This commit enhances the sorting logic for the app list in `MainViewModel.kt`. - Special characters are now removed from app labels before sorting. - Multiple spaces within app labels are collapsed into single spaces. - Leading and trailing spaces are trimmed from app labels. This ensures a more natural and accurate alphabetical sort order for apps with special characters or inconsistent spacing in their names. Signed-off-by: CreativeCodeCat <wayne6324@gmail.com>
1 parent 340fa4f commit 543106e

File tree

2 files changed

+9
-30
lines changed

2 files changed

+9
-30
lines changed

CHANGELOG.md

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
44

5-
## [Coming Soon](https://github.com/DroidWorksStudio/mLauncher/tree/main) - TBD
5+
## [1.11.0.3](https://github.com/DroidWorksStudio/mLauncher/tree/1.11.0.3) - (15, September 2025)
66

77
### Bug Fixes:
88

99
* Correct app label display in HomeAppsWidgetProvider ([43c169f1](https://github.com/DroidWorksStudio/mLauncher/commit/43c169f1))
1010

1111
### Refactors:
1212

13+
* Improve app list sorting ([98ece2ba](https://github.com/DroidWorksStudio/mLauncher/commit/98ece2ba))
1314
* Replace Word of the Day AlarmManager with WorkManager ([a61c988d](https://github.com/DroidWorksStudio/mLauncher/commit/a61c988d))
1415
* Remove SecurityService and FLAG_SECURE ([ca71b87d](https://github.com/DroidWorksStudio/mLauncher/commit/ca71b87d))
1516
* Update cleanMessage regex to include 'docs' ([1bedc196](https://github.com/DroidWorksStudio/mLauncher/commit/1bedc196))
@@ -203,33 +204,5 @@ All notable changes to this project will be documented in this file. See [conven
203204

204205
* Increment build number to 4 ([3267c572](https://github.com/DroidWorksStudio/mLauncher/commit/3267c572))
205206

206-
## [1.10.8.3](https://github.com/DroidWorksStudio/mLauncher/tree/1.10.8.3) - (13, July 2025)
207-
208-
### Bug Fixes:
209-
210-
* Use `GITHUB_TOKEN` for `dependabot` actions ([8887e567](https://github.com/DroidWorksStudio/mLauncher/commit/8887e567))
211-
* Remove dependabot group names ([f0e6880e](https://github.com/DroidWorksStudio/mLauncher/commit/f0e6880e))
212-
* Group all dependency updates ([cca83156](https://github.com/DroidWorksStudio/mLauncher/commit/cca83156))
213-
* Only show "Personal apps" header if other profiles exist ([46ddee8b](https://github.com/DroidWorksStudio/mLauncher/commit/46ddee8b))
214-
215-
### Refactors:
216-
217-
* Implement ViewBinding in OnboardingPageFragment ([55b5d689](https://github.com/DroidWorksStudio/mLauncher/commit/55b5d689))
218-
* Nullify views in OnboardingPageFragment ([2c5710cc](https://github.com/DroidWorksStudio/mLauncher/commit/2c5710cc))
219-
220-
### Build:
221-
222-
* Bump svenstaro/upload-release-action from 2.11.1 to 2.11.2 ([#842](https://github.com/DroidWorksStudio/mLauncher/pull/842)) ([80d30262](https://github.com/DroidWorksStudio/mLauncher/commit/80d30262))
223-
* Bump MyAlbum/purge-cache from 2.1.0 to 2.2.0 ([#841](https://github.com/DroidWorksStudio/mLauncher/pull/841)) ([1fa356c8](https://github.com/DroidWorksStudio/mLauncher/commit/1fa356c8))
224-
225-
### Meta:
226-
227-
* Configure dependabot for GitHub Actions ([b33b311b](https://github.com/DroidWorksStudio/mLauncher/commit/b33b311b))
228-
* Increment build number to 3 ([a9d167d3](https://github.com/DroidWorksStudio/mLauncher/commit/a9d167d3))
229-
230-
### Feature Removals:
231-
232-
* Remove deprecated workflow ([4ffadaf5](https://github.com/DroidWorksStudio/mLauncher/commit/4ffadaf5))
233-
234207
---
235208
> Generated by DroidWorksStudio

app/src/main/java/com/github/droidworksstudio/mlauncher/MainViewModel.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,13 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
480480
// Sort the list
481481
fullList.sortWith(
482482
compareBy<AppListItem> { it.category.ordinal }
483-
.thenBy { it.label.lowercase() }
483+
.thenBy {
484+
it.label
485+
.replace(Regex("[^\\p{L}\\p{N}\\s]"), "") // keep letters, numbers, spaces
486+
.replace(Regex("\\s+"), " ") // collapse multiple spaces
487+
.trim() // remove leading/trailing spaces
488+
.lowercase()
489+
}
484490
)
485491

486492
// Build scroll index

0 commit comments

Comments
 (0)