mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-10-10 17:51:48 +00:00
[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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user