mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
feat: added filter for songs that don't meet a user defined rating threshold
This commit is contained in:
parent
612c05fabc
commit
121c2b33da
9 changed files with 73 additions and 0 deletions
|
|
@ -307,4 +307,17 @@ public class MusicUtil {
|
|||
private static ConnectivityManager getConnectivityManager() {
|
||||
return (ConnectivityManager) App.getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
}
|
||||
|
||||
public static void ratingFilter(List<Child> toFilter) {
|
||||
if (toFilter == null || toFilter.isEmpty()) return;
|
||||
|
||||
List<Child> filtered = toFilter
|
||||
.stream()
|
||||
.filter(child -> (child.getUserRating() != null && child.getUserRating() >= Preferences.getMinStarRatingAccepted()) || (child.getUserRating() == null))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
toFilter.clear();
|
||||
|
||||
toFilter.addAll(filtered);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue