fix setSortMode range check

Modes are inverted indexes, so we can not use Math.abs()
This commit is contained in:
Adrian Ulrich 2017-02-03 21:36:10 +01:00
parent e5e9ba3022
commit c0854e2740

View File

@ -560,9 +560,10 @@ public class MediaAdapter
* is negative, the inverse of the index will be used and sort order will
* be reversed.
*/
public void setSortMode(int i)
public void setSortMode(int mode)
{
mSortMode = (Math.abs(i) < mSortEntries.length ? i : 0);
int index = ( mode < 0 ? ~mode : mode); // 'negative' modes are actually inverted indexes
mSortMode = index < mSortEntries.length ? mode : 0;
}
/**