[History sort mode] Fix inconsistent History title when opened from sidebar

When the History page was opened from the sidebar, onResume()
always reset the top bar title to "History", regardless of the
selected sort mode.
Now, show the current sort mode instead.
Also the sort mode to string resource mapping is moved into
StatisticSortMode, so new modes can be added without changing
displaySortMode().
This commit is contained in:
TransZAllen
2026-10-07 02:40:53 +02:00
committed by Tobi
parent be28d12b77
commit 3e2a58c839
@@ -102,7 +102,7 @@ public class StatisticsPlaylistFragment
public void onResume() {
super.onResume();
if (activity != null) {
setTitle(activity.getString(R.string.title_activity_history));
displaySortMode(sortMode);
}
}
@@ -384,9 +384,24 @@ public class StatisticsPlaylistFragment
return new SinglePlayQueue(streamInfoItems, index);
}
private void displaySortMode(final StatisticSortMode mode) {
final int resourceIdOfSortMode = mode.getResourceId();
setTitle(getString(resourceIdOfSortMode));
}
private enum StatisticSortMode {
LAST_PLAYED,
MOST_PLAYED,
LAST_PLAYED(R.string.title_last_played),
MOST_PLAYED(R.string.title_most_played);
private final int resourceId;
StatisticSortMode(final int theResourceId) {
this.resourceId = theResourceId;
}
int getResourceId() {
return resourceId;
}
}
}