Merge pull request #4443 from Bnyro/master

feat: download option in audio player
This commit is contained in:
Bnyro 2023-08-13 11:15:02 +02:00 committed by GitHub
commit f642aa0d24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.obj.ShareData
import com.github.libretube.services.OnlinePlayerService import com.github.libretube.services.OnlinePlayerService
import com.github.libretube.ui.activities.MainActivity 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.dialogs.ShareDialog
import com.github.libretube.ui.interfaces.AudioPlayerOptions import com.github.libretube.ui.interfaces.AudioPlayerOptions
import com.github.libretube.ui.listeners.AudioPlayerThumbnailListener import com.github.libretube.ui.listeners.AudioPlayerThumbnailListener
@ -111,10 +112,6 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
binding.playerMotionLayout.transitionToEnd() binding.playerMotionLayout.transitionToEnd()
} }
binding.dropdownMenu.setOnClickListener {
onLongTap()
}
binding.autoPlay.isChecked = PlayerHelper.autoPlayEnabled binding.autoPlay.isChecked = PlayerHelper.autoPlayEnabled
binding.autoPlay.setOnCheckedChangeListener { _, isChecked -> binding.autoPlay.setOnCheckedChangeListener { _, isChecked ->
PlayerHelper.autoPlayEnabled = 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 { binding.share.setOnClickListener {
val currentVideo = PlayingQueue.getCurrent() ?: return@setOnClickListener val currentVideo = PlayingQueue.getCurrent() ?: return@setOnClickListener
ShareDialog( ShareDialog(

View File

@ -56,16 +56,6 @@
app:track="@drawable/player_switch_track" app:track="@drawable/player_switch_track"
app:trackTint="?colorControlNormal" /> 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> </LinearLayout>
<FrameLayout <FrameLayout
@ -298,6 +288,11 @@
style="@style/AudioPlayerButton" style="@style/AudioPlayerButton"
android:src="@drawable/ic_video" /> android:src="@drawable/ic_video" />
<ImageView
android:id="@+id/download"
style="@style/AudioPlayerButton"
android:src="@drawable/ic_download" />
<ImageView <ImageView
android:id="@+id/share" android:id="@+id/share"
style="@style/AudioPlayerButton" style="@style/AudioPlayerButton"