feat: download option in audio player

This commit is contained in:
Bnyro 2023-08-13 11:15:37 +02:00
parent deebd75dbf
commit 886283c4cc
2 changed files with 12 additions and 14 deletions

View File

@ -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(

View File

@ -56,16 +56,6 @@
app:track="@drawable/player_switch_track"
app:trackTint="?colorControlNormal" />
<ImageView
android:id="@+id/dropdown_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="?selectableItemBackgroundBorderless"
android:scaleX="0.8"
android:scaleY="0.8"
android:src="@drawable/ic_three_dots" />
</LinearLayout>
<FrameLayout
@ -298,6 +288,11 @@
style="@style/AudioPlayerButton"
android:src="@drawable/ic_video" />
<ImageView
android:id="@+id/download"
style="@style/AudioPlayerButton"
android:src="@drawable/ic_download" />
<ImageView
android:id="@+id/share"
style="@style/AudioPlayerButton"