SimpleMobileTools / Simple-Music-Player

A clean music player with a customizable widget, stylish interface and no ads.
https://www.simplemobiletools.com
GNU General Public License v3.0
1.28k stars 406 forks source link

Crash fixes and improvements #580

Closed naveensingh closed 1 year ago

naveensingh commented 1 year ago

Changes:

tibbi commented 1 year ago

cannot compile, tracksadapter 282 is missing sorting parameter

naveensingh commented 1 year ago

I see, my bad. My IDE is probably malfunctioning, it compiled successfully and I didn't even get any crashes. I'm checking it now

naveensingh commented 1 year ago

Check it now, please. You can reproduce the crash on 5.17.1 using this:

private fun testSorting() {
    val sortMethods = listOf(PLAYER_SORT_BY_DATE_ADDED, PLAYER_SORT_BY_TRACK_ID, PLAYER_SORT_BY_ARTIST_TITLE, PLAYER_SORT_BY_TITLE, PLAYER_SORT_BY_DURATION)
    ensureBackgroundThread {
        repeat(25) {
            sortMethods.shuffled().forEach { sorting ->
                ensureBackgroundThread {
                    config.trackSorting = sorting
                    Thread.sleep((0L..2L).random())
                    try {
                        applicationContext.audioHelper.getAllTracks()
                    } catch (e: Exception) {
                        throw Exception("failed to sort by ${sorting}, error: ${e.message}")
                    }
                }
            }
        }
    }
}
tibbi commented 1 year ago

ok thanks, Ill trust you on this one :)