mirror of
https://github.com/antebudimir/tempus.git
synced 2026-04-15 16:27:26 +00:00
feat: save q to playlist, removed save queue button, added style to fab.
This commit is contained in:
parent
732b6ad09d
commit
27f5a47cc9
4 changed files with 55 additions and 20 deletions
|
|
@ -6,6 +6,7 @@ import android.util.Log;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
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.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.ui.adapter.PlayerSongQueueAdapter;
|
||||
import com.cappielloantonio.tempo.ui.dialog.PlaylistChooserDialog;
|
||||
import com.cappielloantonio.tempo.util.Constants;
|
||||
import com.cappielloantonio.tempo.viewmodel.PlaybackViewModel;
|
||||
import com.cappielloantonio.tempo.viewmodel.PlayerBottomSheetViewModel;
|
||||
|
|
@ -31,6 +33,7 @@ import com.google.common.util.concurrent.MoreExecutors;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@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 fabDownloadAll;
|
||||
private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabSaveQueue;
|
||||
private com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton fabLoadQueue;
|
||||
|
||||
private boolean isMenuOpen = false;
|
||||
|
|
@ -73,7 +75,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
|||
|
||||
fabSaveToPlaylist = bind.fabSaveToPlaylist;
|
||||
fabDownloadAll = bind.fabDownloadAll;
|
||||
fabSaveQueue = bind.fabSaveQueue;
|
||||
fabLoadQueue = bind.fabLoadQueue;
|
||||
|
||||
fabMenuToggle.setOnClickListener(v -> toggleFabMenu());
|
||||
|
|
@ -82,7 +83,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
|||
|
||||
fabSaveToPlaylist.setOnClickListener(v -> handleSaveToPlaylistClick());
|
||||
fabDownloadAll.setOnClickListener(v -> handleDownloadAllClick());
|
||||
fabSaveQueue.setOnClickListener(v -> handleSaveQueueClick());
|
||||
fabLoadQueue.setOnClickListener(v -> handleLoadQueueClick());
|
||||
|
||||
initQueueRecyclerView();
|
||||
|
|
@ -246,7 +246,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
|||
// CLOSE MENU (Reverse order for visual effect)
|
||||
closeFab(fabSaveToPlaylist, 5);
|
||||
closeFab(fabDownloadAll, 4);
|
||||
closeFab(fabSaveQueue, 3);
|
||||
closeFab(fabLoadQueue, 2);
|
||||
closeFab(fabClearQueue, 1);
|
||||
closeFab(fabShuffleQueue, 0);
|
||||
|
|
@ -257,7 +256,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
|||
openFab(fabShuffleQueue, 0);
|
||||
openFab(fabClearQueue, 1);
|
||||
openFab(fabLoadQueue, 2);
|
||||
openFab(fabSaveQueue, 3);
|
||||
openFab(fabDownloadAll, 4);
|
||||
openFab(fabSaveToPlaylist, 5);
|
||||
|
||||
|
|
@ -352,7 +350,23 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -361,10 +375,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
|||
toggleFabMenu();
|
||||
}
|
||||
|
||||
private void handleSaveQueueClick() {
|
||||
Log.d(TAG, "Save Queue Clicked! (Placeholder)");
|
||||
toggleFabMenu();
|
||||
}
|
||||
|
||||
private void handleLoadQueueClick() {
|
||||
Log.d(TAG, "Load Queue Clicked! (Placeholder)");
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone"
|
||||
android:text="Save to Playlist (TODO)"
|
||||
android:text="Save Queue to Playlist"
|
||||
tools:ignore="HardcodedText"
|
||||
app:icon="@android:drawable/ic_menu_edit" />
|
||||
|
||||
|
|
@ -49,15 +49,6 @@
|
|||
tools:ignore="HardcodedText"
|
||||
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
|
||||
android:id="@+id/fab_load_queue"
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@
|
|||
<item name="android:statusBarColor">?attr/colorSurface</item>
|
||||
<item name="android:navigationBarColor">?attr/colorSurface</item>
|
||||
<item name="android:scrollbars">none</item>
|
||||
|
||||
<item name="floatingActionButtonStyle">@style/FloatingActionButtonStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="Divider">
|
||||
|
|
@ -40,6 +42,21 @@
|
|||
<item name="android:background">@color/dividerColor</item>
|
||||
</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">
|
||||
<item name="background">?attr/colorErrorContainer</item>
|
||||
<item name="android:textColor">?attr/colorOnErrorContainer</item>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@
|
|||
<item name="android:statusBarColor">?attr/colorSurface</item>
|
||||
<item name="android:navigationBarColor">?attr/colorSurface</item>
|
||||
<item name="android:scrollbars">none</item>
|
||||
|
||||
<item name="floatingActionButtonStyle">@style/FloatingActionButtonStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="Divider">
|
||||
|
|
@ -47,6 +49,21 @@
|
|||
<item name="android:background">@color/dividerColor</item>
|
||||
</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">
|
||||
<item name="background">?attr/colorErrorContainer</item>
|
||||
<item name="android:textColor">?attr/colorOnErrorContainer</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue