Start of work for a structural modification of the player

This commit is contained in:
CappielloAntonio 2022-01-02 20:53:11 +01:00
parent 9fdc9ff44d
commit 0fbf3a4cdf
18 changed files with 900 additions and 484 deletions

View file

@ -0,0 +1,34 @@
package com.cappielloantonio.play.adapter;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import com.cappielloantonio.play.ui.fragment.PlayerControllerFragment;
import com.cappielloantonio.play.ui.fragment.PlayerQueueFragment;
public class PlayerBodyAdapter extends FragmentStateAdapter {
private static final String TAG = "PlayerNowPlayingSongInfoAdapter";
public PlayerBodyAdapter(@NonNull Fragment fragment) {
super(fragment);
}
@NonNull
@Override
public Fragment createFragment(int position) {
switch (position) {
case 0:
return new PlayerControllerFragment();
case 1:
return new PlayerQueueFragment();
}
return new PlayerControllerFragment();
}
@Override
public int getItemCount() {
return 2;
}
}

View file

@ -27,15 +27,13 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
private static final String TAG = "SongResultSearchAdapter";
private final LayoutInflater mInflater;
private final PlayerBottomSheetFragment playerBottomSheetFragment;
private final Context context;
private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture;
private List<Song> songs;
public PlayerSongQueueAdapter(Context context, PlayerBottomSheetFragment playerBottomSheetFragment) {
public PlayerSongQueueAdapter(Context context) {
this.context = context;
this.playerBottomSheetFragment = playerBottomSheetFragment;
this.mInflater = LayoutInflater.from(context);
this.songs = new ArrayList<>();
}