fix: fix click on mediaitem

This commit is contained in:
antonio 2023-08-22 14:22:20 +02:00
parent 1d65a79c20
commit c0a665c00a
2 changed files with 7 additions and 3 deletions

View file

@ -114,7 +114,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
public void onClick() {
Bundle bundle = new Bundle();
bundle.putParcelableArrayList(Constants.TRACKS_OBJECT, new ArrayList<>(MusicUtil.limitPlayableMedia(songs, getBindingAdapterPosition())));
bundle.putInt(Constants.ITEM_POSITION, MusicUtil.getPlayableMediaPosition(getBindingAdapterPosition()));
bundle.putInt(Constants.ITEM_POSITION, MusicUtil.getPlayableMediaPosition(songs, getBindingAdapterPosition()));
click.onMediaClick(bundle);
}

View file

@ -271,8 +271,12 @@ public class MusicUtil {
return toLimit;
}
public static int getPlayableMediaPosition(int initialPosition) {
return Math.min(initialPosition, Constants.PRE_PLAYABLE_MEDIA);
public static int getPlayableMediaPosition(List<Child> toLimit, int position) {
if (!toLimit.isEmpty() && toLimit.size() > Constants.PLAYABLE_MEDIA_LIMIT) {
return Math.min(position, Constants.PRE_PLAYABLE_MEDIA);
}
return position;
}
private static ConnectivityManager getConnectivityManager() {