From 886283c4cc644e8fbc828f3e3a6f5064ce6c952a Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 13 Aug 2023 11:15:37 +0200 Subject: [PATCH] feat: download option in audio player --- .../libretube/ui/fragments/AudioPlayerFragment.kt | 11 +++++++---- app/src/main/res/layout/fragment_audio_player.xml | 15 +++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/AudioPlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/AudioPlayerFragment.kt index fd0e78897..907add8db 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/AudioPlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/AudioPlayerFragment.kt @@ -36,6 +36,7 @@ import com.github.libretube.helpers.PlayerHelper import com.github.libretube.obj.ShareData import com.github.libretube.services.OnlinePlayerService import com.github.libretube.ui.activities.MainActivity +import com.github.libretube.ui.dialogs.DownloadDialog import com.github.libretube.ui.dialogs.ShareDialog import com.github.libretube.ui.interfaces.AudioPlayerOptions import com.github.libretube.ui.listeners.AudioPlayerThumbnailListener @@ -111,10 +112,6 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { binding.playerMotionLayout.transitionToEnd() } - binding.dropdownMenu.setOnClickListener { - onLongTap() - } - binding.autoPlay.isChecked = PlayerHelper.autoPlayEnabled binding.autoPlay.setOnCheckedChangeListener { _, isChecked -> PlayerHelper.autoPlayEnabled = isChecked @@ -165,6 +162,12 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { ) } + binding.download.setOnClickListener { + val videoId = PlayingQueue.getCurrent()?.url?.toID() ?: return@setOnClickListener + val downloadDialog = DownloadDialog(videoId) + downloadDialog.show(childFragmentManager, DownloadDialog::class.java.name) + } + binding.share.setOnClickListener { val currentVideo = PlayingQueue.getCurrent() ?: return@setOnClickListener ShareDialog( diff --git a/app/src/main/res/layout/fragment_audio_player.xml b/app/src/main/res/layout/fragment_audio_player.xml index 977467216..f6ef5bdb4 100644 --- a/app/src/main/res/layout/fragment_audio_player.xml +++ b/app/src/main/res/layout/fragment_audio_player.xml @@ -56,16 +56,6 @@ app:track="@drawable/player_switch_track" app:trackTint="?colorControlNormal" /> - - + +