mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Queue elements are now clickable and customized
This commit is contained in:
parent
15e7c28b14
commit
7b5bbd7d53
4 changed files with 46 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ import androidx.media3.common.MediaItem;
|
|||
import androidx.media3.session.MediaBrowser;
|
||||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.interfaces.MediaIndexCallback;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.QueueRepository;
|
||||
import com.cappielloantonio.play.util.MappingUtil;
|
||||
|
|
@ -240,6 +241,20 @@ public class MediaManager {
|
|||
}
|
||||
}
|
||||
|
||||
public static void getCurrentIndex(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, MediaIndexCallback callback) {
|
||||
if (mediaBrowserListenableFuture != null) {
|
||||
mediaBrowserListenableFuture.addListener(() -> {
|
||||
try {
|
||||
if (mediaBrowserListenableFuture.isDone()) {
|
||||
callback.onRecovery(mediaBrowserListenableFuture.get().getCurrentMediaItemIndex());
|
||||
}
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}, MoreExecutors.directExecutor());
|
||||
}
|
||||
}
|
||||
|
||||
public static void timestamp(MediaItem mediaItem) {
|
||||
if (mediaItem != null) getQueueRepository().setTimestamp(mediaItem.mediaId);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue