Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't load audio player thumbnail when data saver mode is on #4433

Merged
merged 1 commit into from
Aug 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import com.github.libretube.ui.sheets.ChaptersBottomSheet
import com.github.libretube.ui.sheets.PlaybackOptionsSheet
import com.github.libretube.ui.sheets.PlayingQueueSheet
import com.github.libretube.ui.sheets.VideoOptionsBottomSheet
import com.github.libretube.util.DataSaverMode
import com.github.libretube.util.PlayingQueue
import kotlin.math.abs

Expand Down Expand Up @@ -275,10 +276,16 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions {
}

private fun updateThumbnailAsync(thumbnailUrl: String) {
if (DataSaverMode.isEnabled(requireContext())) {
binding.progress.isVisible = false
return
}

binding.progress.isVisible = true
binding.thumbnail.isGone = true

ImageHelper.getAsync(requireContext(), thumbnailUrl) {
val binding = _binding ?: return@getAsync
binding.thumbnail.setImageBitmap(it)
binding.miniPlayerThumbnail.setImageBitmap(it)
binding.thumbnail.isVisible = true
Expand Down
Loading