feat: save q to playlist, removed save queue button, added style to fab.

This commit is contained in:
eddyizm 2025-11-27 08:04:40 -08:00
parent 732b6ad09d
commit 27f5a47cc9
No known key found for this signature in database
GPG key ID: CF5F671829E8158A
4 changed files with 55 additions and 20 deletions

View file

@ -6,6 +6,7 @@ import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
@ -23,6 +24,7 @@ import com.cappielloantonio.tempo.service.MediaManager;
import com.cappielloantonio.tempo.service.MediaService; import com.cappielloantonio.tempo.service.MediaService;
import com.cappielloantonio.tempo.subsonic.models.Child; import com.cappielloantonio.tempo.subsonic.models.Child;
import com.cappielloantonio.tempo.ui.adapter.PlayerSongQueueAdapter; import com.cappielloantonio.tempo.ui.adapter.PlayerSongQueueAdapter;
import com.cappielloantonio.tempo.ui.dialog.PlaylistChooserDialog;
import com.cappielloantonio.tempo.util.Constants; import com.cappielloantonio.tempo.util.Constants;
import com.cappielloantonio.tempo.viewmodel.PlaybackViewModel; import com.cappielloantonio.tempo.viewmodel.PlaybackViewModel;
import com.cappielloantonio.tempo.viewmodel.PlayerBottomSheetViewModel; import com.cappielloantonio.tempo.viewmodel.PlayerBottomSheetViewModel;
@ -31,6 +33,7 @@ import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@UnstableApi @UnstableApi
@ -46,7 +49,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabSaveToPlaylist; private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabSaveToPlaylist;
private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabDownloadAll; private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabDownloadAll;
private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabSaveQueue;
private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabLoadQueue; private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabLoadQueue;
private boolean isMenuOpen = false; private boolean isMenuOpen = false;
@ -73,7 +75,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
fabSaveToPlaylist = bind.fabSaveToPlaylist; fabSaveToPlaylist = bind.fabSaveToPlaylist;
fabDownloadAll = bind.fabDownloadAll; fabDownloadAll = bind.fabDownloadAll;
fabSaveQueue = bind.fabSaveQueue;
fabLoadQueue = bind.fabLoadQueue; fabLoadQueue = bind.fabLoadQueue;
fabMenuToggle.setOnClickListener(v -> toggleFabMenu()); fabMenuToggle.setOnClickListener(v -> toggleFabMenu());
@ -82,7 +83,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
fabSaveToPlaylist.setOnClickListener(v -> handleSaveToPlaylistClick()); fabSaveToPlaylist.setOnClickListener(v -> handleSaveToPlaylistClick());
fabDownloadAll.setOnClickListener(v -> handleDownloadAllClick()); fabDownloadAll.setOnClickListener(v -> handleDownloadAllClick());
fabSaveQueue.setOnClickListener(v -> handleSaveQueueClick());
fabLoadQueue.setOnClickListener(v -> handleLoadQueueClick()); fabLoadQueue.setOnClickListener(v -> handleLoadQueueClick());
initQueueRecyclerView(); initQueueRecyclerView();
@ -246,7 +246,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
// CLOSE MENU (Reverse order for visual effect) // CLOSE MENU (Reverse order for visual effect)
closeFab(fabSaveToPlaylist, 5); closeFab(fabSaveToPlaylist, 5);
closeFab(fabDownloadAll, 4); closeFab(fabDownloadAll, 4);
closeFab(fabSaveQueue, 3);
closeFab(fabLoadQueue, 2); closeFab(fabLoadQueue, 2);
closeFab(fabClearQueue, 1); closeFab(fabClearQueue, 1);
closeFab(fabShuffleQueue, 0); closeFab(fabShuffleQueue, 0);
@ -257,7 +256,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
openFab(fabShuffleQueue, 0); openFab(fabShuffleQueue, 0);
openFab(fabClearQueue, 1); openFab(fabClearQueue, 1);
openFab(fabLoadQueue, 2); openFab(fabLoadQueue, 2);
openFab(fabSaveQueue, 3);
openFab(fabDownloadAll, 4); openFab(fabDownloadAll, 4);
openFab(fabSaveToPlaylist, 5); openFab(fabSaveToPlaylist, 5);
@ -352,7 +350,23 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
} }
private void handleSaveToPlaylistClick() { private void handleSaveToPlaylistClick() {
Log.d(TAG, "Save to Playlist Clicked! (Placeholder)"); Log.d(TAG, "Save to Playlist Clicked!");
List<Child> queueSongs = playerSongQueueAdapter.getItems();
if (queueSongs == null || queueSongs.isEmpty()) {
Toast.makeText(requireContext(), "Queue is empty", Toast.LENGTH_SHORT).show();
toggleFabMenu();
return;
}
Bundle bundle = new Bundle();
bundle.putParcelableArrayList(Constants.TRACKS_OBJECT, new ArrayList<>(queueSongs));
PlaylistChooserDialog dialog = new PlaylistChooserDialog();
dialog.setArguments(bundle);
dialog.show(requireActivity().getSupportFragmentManager(), null);
toggleFabMenu(); toggleFabMenu();
} }
@ -361,10 +375,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
toggleFabMenu(); toggleFabMenu();
} }
private void handleSaveQueueClick() {
Log.d(TAG, "Save Queue Clicked! (Placeholder)");
toggleFabMenu();
}
private void handleLoadQueueClick() { private void handleLoadQueueClick() {
Log.d(TAG, "Load Queue Clicked! (Placeholder)"); Log.d(TAG, "Load Queue Clicked! (Placeholder)");

View file

@ -35,7 +35,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:visibility="gone" android:visibility="gone"
android:text="Save to Playlist (TODO)" android:text="Save Queue to Playlist"
tools:ignore="HardcodedText" tools:ignore="HardcodedText"
app:icon="@android:drawable/ic_menu_edit" /> app:icon="@android:drawable/ic_menu_edit" />
@ -49,15 +49,6 @@
tools:ignore="HardcodedText" tools:ignore="HardcodedText"
app:icon="@android:drawable/stat_sys_download_done" /> app:icon="@android:drawable/stat_sys_download_done" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab_save_queue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone"
android:text="Save Queue (TODO)"
tools:ignore="HardcodedText"
app:icon="@android:drawable/ic_menu_save" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab_load_queue" android:id="@+id/fab_load_queue"

View file

@ -32,6 +32,8 @@
<item name="android:statusBarColor">?attr/colorSurface</item> <item name="android:statusBarColor">?attr/colorSurface</item>
<item name="android:navigationBarColor">?attr/colorSurface</item> <item name="android:navigationBarColor">?attr/colorSurface</item>
<item name="android:scrollbars">none</item> <item name="android:scrollbars">none</item>
<item name="floatingActionButtonStyle">@style/FloatingActionButtonStyle</item>
</style> </style>
<style name="Divider"> <style name="Divider">
@ -40,6 +42,21 @@
<item name="android:background">@color/dividerColor</item> <item name="android:background">@color/dividerColor</item>
</style> </style>
<style name="FloatingActionButtonStyle" parent="Widget.MaterialComponents.FloatingActionButton">
<item name="backgroundTint">?attr/colorSecondary</item>
<item name="tint">?attr/colorOnPrimary</item>
<item name="shapeAppearanceOverlay">@style/FabShapeStyle</item>
</style>
<style name="FabShapeStyle" parent="ShapeAppearance.MaterialComponents.SmallComponent">
<item name="cornerSize">50%</item>
<item name="cornerSizeBottomLeft">0dp</item>
<item name="cornerFamilyTopLeft">rounded</item>
<item name="cornerFamilyTopRight">rounded</item>
<item name="cornerFamilyBottomLeft">rounded</item>
<item name="cornerFamilyBottomRight">rounded</item>
</style>
<style name="NoConnectionTextView"> <style name="NoConnectionTextView">
<item name="background">?attr/colorErrorContainer</item> <item name="background">?attr/colorErrorContainer</item>
<item name="android:textColor">?attr/colorOnErrorContainer</item> <item name="android:textColor">?attr/colorOnErrorContainer</item>

View file

@ -39,6 +39,8 @@
<item name="android:statusBarColor">?attr/colorSurface</item> <item name="android:statusBarColor">?attr/colorSurface</item>
<item name="android:navigationBarColor">?attr/colorSurface</item> <item name="android:navigationBarColor">?attr/colorSurface</item>
<item name="android:scrollbars">none</item> <item name="android:scrollbars">none</item>
<item name="floatingActionButtonStyle">@style/FloatingActionButtonStyle</item>
</style> </style>
<style name="Divider"> <style name="Divider">
@ -47,6 +49,21 @@
<item name="android:background">@color/dividerColor</item> <item name="android:background">@color/dividerColor</item>
</style> </style>
<style name="FloatingActionButtonStyle" parent="Widget.MaterialComponents.FloatingActionButton">
<item name="backgroundTint">?attr/colorSecondary</item>
<item name="tint">?attr/colorOnPrimary</item>
<item name="shapeAppearanceOverlay">@style/FabShapeStyle</item>
</style>
<style name="FabShapeStyle" parent="ShapeAppearance.MaterialComponents.SmallComponent">
<item name="cornerSize">50%</item>
<item name="cornerSizeBottomLeft">0dp</item>
<item name="cornerFamilyTopLeft">rounded</item>
<item name="cornerFamilyTopRight">rounded</item>
<item name="cornerFamilyBottomLeft">rounded</item>
<item name="cornerFamilyBottomRight">rounded</item>
</style>
<style name="NoConnectionTextView"> <style name="NoConnectionTextView">
<item name="background">?attr/colorErrorContainer</item> <item name="background">?attr/colorErrorContainer</item>
<item name="android:textColor">?attr/colorOnErrorContainer</item> <item name="android:textColor">?attr/colorOnErrorContainer</item>