diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/DriveModeActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/DriveModeActivity.kt index 633bf0fd..3602d86f 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/DriveModeActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/DriveModeActivity.kt @@ -34,6 +34,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.util.MusicUtil +import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import com.bumptech.glide.Glide import kotlinx.android.synthetic.main.activity_drive_mode.* import kotlinx.coroutines.CoroutineScope @@ -217,7 +218,7 @@ class DriveModeActivity : AbsMusicServiceActivity(), Callback { .build() .transform(BlurTransformation.Builder(this).build()) .into(object : RetroMusicColoredTarget(image) { - override fun onColorReady(color: Int) { + override fun onColorReady(color: MediaNotificationProcessor) { } }) } diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt index 1bec676e..a97c592b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt @@ -246,7 +246,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), TINY -> TinyPlayerFragment() PEAK -> PeakPlayerFragment() CIRCLE -> CirclePlayerFragment() - EXAMPLE -> ClassicPlayerFragment() + CLASSIC -> ClassicPlayerFragment() else -> PlayerFragment() } // must implement AbsPlayerFragment supportFragmentManager.beginTransaction().replace(R.id.playerFragmentContainer, fragment) diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt index 5e4c7253..92124757 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt @@ -9,6 +9,7 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import code.name.monkey.retromusic.R import code.name.monkey.retromusic.fragments.AlbumCoverStyle +import code.name.monkey.retromusic.fragments.NowPlayingScreen import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.misc.CustomFragmentStatePagerAdapter @@ -94,12 +95,7 @@ class AlbumCoverPagerAdapter( container: ViewGroup?, savedInstanceState: Bundle? ): View? { - val finalLayout = when { - PreferenceUtil.getInstance(requireContext()) - .carouselEffect() -> R.layout.fragment_album_carousel_cover - else -> layout - } - val view = inflater.inflate(finalLayout, container, false) + val view = inflater.inflate(getLayoutWithPlayerTheme(), container, false) albumCover = view.findViewById(R.id.player_image) albumCover.setOnClickListener { NavigationUtil.goToLyrics(requireActivity()) @@ -107,6 +103,34 @@ class AlbumCoverPagerAdapter( return view } + private fun getLayoutWithPlayerTheme(): Int { + return when (PreferenceUtil.getInstance(requireContext()).nowPlayingScreen) { + NowPlayingScreen.CARD, + NowPlayingScreen.FIT, + NowPlayingScreen.TINY, + NowPlayingScreen.CLASSIC, + NowPlayingScreen.FULL -> R.layout.fragment_album_full_cover + else -> { + if (PreferenceUtil.getInstance(requireContext()) + .carouselEffect() + ) { + R.layout.fragment_album_carousel_cover + } else { + when (PreferenceUtil.getInstance(requireContext()).albumCoverStyle) { + AlbumCoverStyle.NORMAL -> R.layout.fragment_album_cover + AlbumCoverStyle.FLAT -> R.layout.fragment_album_flat_cover + AlbumCoverStyle.CIRCLE -> R.layout.fragment_album_circle_cover + AlbumCoverStyle.CARD -> R.layout.fragment_album_card_cover + AlbumCoverStyle.MATERIAL -> R.layout.fragment_album_material_cover + AlbumCoverStyle.FULL -> R.layout.fragment_album_full_cover + AlbumCoverStyle.FULL_CARD -> R.layout.fragment_album_full_card_cover + else -> R.layout.fragment_album_cover + } + } + } + } + } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) loadAlbumCover() diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/AddToPlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/AddToPlaylistDialog.kt index c82617b5..2360e3b8 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/AddToPlaylistDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/AddToPlaylistDialog.kt @@ -20,30 +20,25 @@ import androidx.fragment.app.DialogFragment import code.name.monkey.retromusic.R import code.name.monkey.retromusic.loaders.PlaylistLoader import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.room.playlist.PlaylistDatabaseModel -import code.name.monkey.retromusic.room.playlist.PlaylistEntity +import code.name.monkey.retromusic.util.PlaylistsUtil import code.name.monkey.retromusic.util.PreferenceUtil +import com.afollestad.materialdialogs.LayoutMode import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.bottomsheets.BottomSheet import com.afollestad.materialdialogs.list.listItems -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch class AddToPlaylistDialog : DialogFragment() { override fun onCreateDialog( savedInstanceState: Bundle? ): Dialog { - - val names = requireArguments().getParcelableArrayList("names") val playlists = PlaylistLoader.getAllPlaylists(requireContext()) val playlistNames: MutableList = mutableListOf() playlistNames.add(requireContext().resources.getString(R.string.action_new_playlist)) - for (p in names!!) { - playlistNames.add(p.playlistName) + for (p in playlists) { + playlistNames.add(p.name) } - return MaterialDialog(requireContext()).show { title(R.string.add_playlist_title) cornerRadius(PreferenceUtil.getInstance(requireContext()).dialogCorner) @@ -57,18 +52,12 @@ class AddToPlaylistDialog : DialogFragment() { } } else { dialog.dismiss() - /*PlaylistsUtil.addToPlaylist( + PlaylistsUtil.addToPlaylist( requireContext(), songs, playlists[index - 1].id, true - )*/ - - GlobalScope.launch(Dispatchers.IO) { - PlaylistDatabaseModel().also { - it.addSongsToPlaylist(songs, names[index - 1]) - } - } + ) } } } @@ -89,17 +78,5 @@ class AddToPlaylistDialog : DialogFragment() { dialog.arguments = args return dialog } - - fun create( - songs: ArrayList, - names: List - ): AddToPlaylistDialog { - val dialog = AddToPlaylistDialog() - val args = Bundle() - args.putParcelableArrayList("songs", ArrayList(songs)) - args.putParcelableArrayList("names", ArrayList(names)) - dialog.arguments = args - return dialog - } } } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt index 650cc688..3dd81153 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/CreatePlaylistDialog.kt @@ -24,10 +24,7 @@ import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R.layout import code.name.monkey.retromusic.R.string import code.name.monkey.retromusic.extensions.appHandleColor -import code.name.monkey.retromusic.fragments.playlists.PlaylistViewModel import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.room.playlist.PlaylistDatabaseModel -import code.name.monkey.retromusic.room.playlist.PlaylistEntity import code.name.monkey.retromusic.util.PlaylistsUtil import code.name.monkey.retromusic.util.PreferenceUtil import com.afollestad.materialdialogs.LayoutMode @@ -60,14 +57,13 @@ class CreatePlaylistDialog : DialogFragment() { ?: return@positiveButton if (playlistView.text.toString().trim { it <= ' ' }.isNotEmpty()) { - /*val playlistId = PlaylistsUtil.createPlaylist( + val playlistId = PlaylistsUtil.createPlaylist( requireContext(), playlistView.text.toString() ) if (playlistId != -1) { PlaylistsUtil.addToPlaylist(requireContext(), songs, playlistId, true) - }*/ - PlaylistDatabaseModel().savePlaylist(PlaylistEntity(playlistView.text.toString())) + } } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/NowPlayingScreen.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/NowPlayingScreen.kt index 71c86544..72b87f73 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/NowPlayingScreen.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/NowPlayingScreen.kt @@ -26,5 +26,5 @@ enum class NowPlayingScreen constructor( PLAIN(R.string.plain, R.drawable.np_plain, 3), SIMPLE(R.string.simple, R.drawable.np_simple, 8), TINY(R.string.tiny, R.drawable.np_tiny, 7), - EXAMPLE(R.string.tiny, R.drawable.np_tiny, 16), + CLASSIC(R.string.classic, R.drawable.np_tiny, 16), } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt index b8fe2caa..ceee29c2 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/color/ColorFragment.kt @@ -38,13 +38,15 @@ class ColorFragment : AbsPlayerFragment() { ToolbarContentTintHelper.colorizeToolbar( playerToolbar, - ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal), + color.secondaryTextColor, requireActivity() ) + colorGradientBackground?.setBackgroundColor(color.backgroundColor) + playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(color.backgroundColor)) } override fun onFavoriteToggled() { - //toggleFavorite(MusicPlayerRemote.currentSong) + toggleFavorite(MusicPlayerRemote.currentSong) } override fun onShow() { @@ -130,10 +132,7 @@ class ColorFragment : AbsPlayerFragment() { companion object { fun newInstance(): ColorFragment { - val args = Bundle() - val fragment = ColorFragment() - fragment.arguments = args - return fragment + return ColorFragment() } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt index c8229d42..bdbff361 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/material/MaterialControlsFragment.kt @@ -140,9 +140,9 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() { private fun updatePlayPauseDrawableState() { if (MusicPlayerRemote.isPlaying) { - playPauseButton.setImageResource(R.drawable.ic_pause_white_64dp) + playPauseButton.setImageResource(R.drawable.ic_pause_sharp_white_64dp) } else { - playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_64dp) + playPauseButton.setImageResource(R.drawable.ic_play_arrow_sharp_white_64dp) } } @@ -189,18 +189,18 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() { override fun updateRepeatState() { when (MusicPlayerRemote.repeatMode) { MusicService.REPEAT_MODE_NONE -> { - repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp) + repeatButton.setImageResource(R.drawable.ic_repeat_sharp_white_24dp) repeatButton.setColorFilter( lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN ) } MusicService.REPEAT_MODE_ALL -> { - repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp) + repeatButton.setImageResource(R.drawable.ic_repeat_sharp_white_24dp) repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN) } MusicService.REPEAT_MODE_THIS -> { - repeatButton.setImageResource(R.drawable.ic_repeat_one_white_24dp) + repeatButton.setImageResource(R.drawable.ic_repeat_one_sharp_white_24dp) repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN) } } diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/menu/SongMenuHelper.kt b/app/src/main/java/code/name/monkey/retromusic/helper/menu/SongMenuHelper.kt index 409123bd..933ec60e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/helper/menu/SongMenuHelper.kt +++ b/app/src/main/java/code/name/monkey/retromusic/helper/menu/SongMenuHelper.kt @@ -29,17 +29,12 @@ import code.name.monkey.retromusic.dialogs.SongDetailDialog import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.interfaces.PaletteColorHolder import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.room.playlist.PlaylistDatabaseModel import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.RingtoneManager -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.async -import kotlinx.coroutines.launch object SongMenuHelper { - val MENU_RES = R.menu.menu_item_song + const val MENU_RES = R.menu.menu_item_song fun handleMenuClick(activity: FragmentActivity, song: Song, menuItemId: Int): Boolean { when (menuItemId) { @@ -66,15 +61,8 @@ object SongMenuHelper { return true } R.id.action_add_to_playlist -> { - /* AddToPlaylistDialog.create(song) - .show(activity.supportFragmentManager, "ADD_PLAYLIST")*/ - - GlobalScope.launch(Dispatchers.IO) { - val names = async { PlaylistDatabaseModel().getPlaylistNames() }.await() - println(names.toString()) - AddToPlaylistDialog.create(arrayListOf(song), names) - .show(activity.supportFragmentManager, "ADD_PLAYLIST") - } + AddToPlaylistDialog.create(song) + .show(activity.supportFragmentManager, "ADD_PLAYLIST") return true } R.id.action_play_next -> { diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/menu/SongsMenuHelper.kt b/app/src/main/java/code/name/monkey/retromusic/helper/menu/SongsMenuHelper.kt index 5e68ac42..36d110f5 100644 --- a/app/src/main/java/code/name/monkey/retromusic/helper/menu/SongsMenuHelper.kt +++ b/app/src/main/java/code/name/monkey/retromusic/helper/menu/SongsMenuHelper.kt @@ -21,11 +21,6 @@ import code.name.monkey.retromusic.dialogs.AddToPlaylistDialog import code.name.monkey.retromusic.dialogs.DeleteSongsDialog import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.room.playlist.PlaylistDatabaseModel -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.async -import kotlinx.coroutines.launch import java.util.* @@ -45,12 +40,8 @@ object SongsMenuHelper { return true } R.id.action_add_to_playlist -> { - GlobalScope.launch(Dispatchers.IO) { - val names = async { PlaylistDatabaseModel().getPlaylistNames() }.await() - println(names.toString()) - /*AddToPlaylistDialog.create(songs, names.await()) - .show(activity.supportFragmentManager, "ADD_PLAYLIST")*/ - } + AddToPlaylistDialog.create(songs) + .show(activity.supportFragmentManager, "ADD_PLAYLIST") return true } R.id.action_delete_from_device -> { diff --git a/app/src/main/res/drawable/ic_pause_sharp_white_64dp.xml b/app/src/main/res/drawable/ic_pause_sharp_white_64dp.xml new file mode 100644 index 00000000..1cdfb49d --- /dev/null +++ b/app/src/main/res/drawable/ic_pause_sharp_white_64dp.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_play_arrow_sharp_white_64dp.xml b/app/src/main/res/drawable/ic_play_arrow_sharp_white_64dp.xml new file mode 100644 index 00000000..5b03f483 --- /dev/null +++ b/app/src/main/res/drawable/ic_play_arrow_sharp_white_64dp.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_repeat_one_sharp_white_24dp.xml b/app/src/main/res/drawable/ic_repeat_one_sharp_white_24dp.xml new file mode 100644 index 00000000..a0dbdbae --- /dev/null +++ b/app/src/main/res/drawable/ic_repeat_one_sharp_white_24dp.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_repeat_sharp_white_24dp.xml b/app/src/main/res/drawable/ic_repeat_sharp_white_24dp.xml new file mode 100644 index 00000000..771cddf5 --- /dev/null +++ b/app/src/main/res/drawable/ic_repeat_sharp_white_24dp.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_shuffle_sharp_white_24dp.xml b/app/src/main/res/drawable/ic_shuffle_sharp_white_24dp.xml new file mode 100644 index 00000000..e56b2e36 --- /dev/null +++ b/app/src/main/res/drawable/ic_shuffle_sharp_white_24dp.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_skip_next_sharp_white_24dp.xml b/app/src/main/res/drawable/ic_skip_next_sharp_white_24dp.xml new file mode 100644 index 00000000..96722564 --- /dev/null +++ b/app/src/main/res/drawable/ic_skip_next_sharp_white_24dp.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_skip_previous_sharp_white_24dp.xml b/app/src/main/res/drawable/ic_skip_previous_sharp_white_24dp.xml new file mode 100644 index 00000000..503c81ad --- /dev/null +++ b/app/src/main/res/drawable/ic_skip_previous_sharp_white_24dp.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_material_playback_controls.xml b/app/src/main/res/layout/fragment_material_playback_controls.xml index 3341d270..abd43167 100644 --- a/app/src/main/res/layout/fragment_material_playback_controls.xml +++ b/app/src/main/res/layout/fragment_material_playback_controls.xml @@ -146,7 +146,7 @@ app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toEndOf="@+id/repeatButton" app:layout_constraintTop_toTopOf="@+id/playPauseButton" - app:srcCompat="@drawable/ic_skip_previous_white_24dp" + app:srcCompat="@drawable/ic_skip_previous_sharp_white_24dp" tools:ignore="MissingPrefix" tools:tint="@color/md_black_1000" /> @@ -160,7 +160,7 @@ app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toEndOf="@+id/previousButton" app:layout_constraintTop_toBottomOf="@+id/songInfo" - app:srcCompat="@drawable/ic_pause_white_64dp" + app:srcCompat="@drawable/ic_pause_sharp_white_64dp" tools:tint="@color/md_black_1000" /> @@ -190,7 +190,7 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/nextButton" app:layout_constraintTop_toTopOf="@+id/nextButton" - app:srcCompat="@drawable/ic_shuffle_white_24dp" + app:srcCompat="@drawable/ic_shuffle_sharp_white_24dp" tools:ignore="MissingPrefix" tools:tint="@color/md_black_1000" />