mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 22:35:39 +00:00
Android: Sort game list by title
This commit is contained in:
parent
c5044768a8
commit
41558f4df3
|
@ -12,6 +12,8 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class GameList {
|
public class GameList {
|
||||||
|
@ -25,10 +27,19 @@ public class GameList {
|
||||||
mEntries = new GameListEntry[0];
|
mEntries = new GameListEntry[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class GameListEntryComparator implements Comparator<GameListEntry> {
|
||||||
|
@Override
|
||||||
|
public int compare(GameListEntry left, GameListEntry right) {
|
||||||
|
return left.getTitle().compareTo(right.getTitle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void refresh(boolean invalidateCache, boolean invalidateDatabase) {
|
public void refresh(boolean invalidateCache, boolean invalidateDatabase) {
|
||||||
// Search and get entries from native code
|
// Search and get entries from native code
|
||||||
AndroidHostInterface.getInstance().refreshGameList(invalidateCache, invalidateDatabase);
|
AndroidHostInterface.getInstance().refreshGameList(invalidateCache, invalidateDatabase);
|
||||||
mEntries = AndroidHostInterface.getInstance().getGameListEntries();
|
mEntries = AndroidHostInterface.getInstance().getGameListEntries();
|
||||||
|
Arrays.sort(mEntries, new GameListEntryComparator());
|
||||||
mAdapter.notifyDataSetChanged();
|
mAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue