implement scroll to currently playing feature (#247)

This commit is contained in:
eddyizm 2025-11-09 13:49:29 -08:00 committed by GitHub
commit ec0eee9d3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,7 @@ package com.cappielloantonio.tempo.ui.fragment;
import android.content.ComponentName;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -72,6 +73,12 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
super.onResume();
setMediaBrowserListenableFuture();
updateNowPlayingItem();
try {
long position = mediaBrowserListenableFuture.get().getCurrentMediaItemIndex();
bind.playerQueueRecyclerView.scrollToPosition((int) position);
} catch (Exception e) {
Log.e("PlayerQueueFragment", "Failed to get mediaBrowserListenableFuture in onResume", e);
}
}
@Override