From 82513909d0b10e10e685d09ab55fc2b32299042e Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 8 Sep 2023 17:04:25 +0200 Subject: [PATCH] feat: elevate miniplayer background color for better distinguishability --- .../github/libretube/ui/fragments/AudioPlayerFragment.kt | 4 ++++ .../com/github/libretube/ui/fragments/PlayerFragment.kt | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 e4d86dd24..7670743b6 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 @@ -51,6 +51,7 @@ 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 com.google.android.material.elevation.SurfaceColors import kotlinx.coroutines.launch import kotlin.math.abs @@ -238,6 +239,9 @@ class AudioPlayerFragment : Fragment(), AudioPlayerOptions { mainActivity.binding.container.isVisible = true val mainMotionLayout = mainActivity.binding.mainMotionLayout + val surfaceColor = SurfaceColors.getColorForElevation(requireContext(), 3f) + binding.audioPlayerContainer.setBackgroundColor(surfaceColor) + binding.playerMotionLayout.addTransitionListener(object : TransitionAdapter() { override fun onTransitionChange( motionLayout: MotionLayout?, diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index d5648cad3..a4ef27539 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -94,7 +94,6 @@ import com.github.libretube.obj.PlayerNotificationData import com.github.libretube.obj.ShareData import com.github.libretube.obj.VideoResolution import com.github.libretube.parcelable.PlayerData -import com.github.libretube.services.DownloadService import com.github.libretube.ui.activities.MainActivity import com.github.libretube.ui.activities.VideoTagsAdapter import com.github.libretube.ui.adapters.VideosAdapter @@ -120,6 +119,7 @@ import com.github.libretube.util.TextUtils import com.github.libretube.util.TextUtils.toTimeInSeconds import com.github.libretube.util.YoutubeHlsPlaylistParser import com.github.libretube.util.deArrow +import com.google.android.material.elevation.SurfaceColors import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -312,6 +312,10 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { mainActivity.binding.container.isVisible = true val mainMotionLayout = mainActivity.binding.mainMotionLayout + // add some elevation to the color to make it easier to distinguish + val surfaceColor = SurfaceColors.getColorForElevation(requireContext(), 3f) + binding.mainContainer.setBackgroundColor(surfaceColor) + binding.playerMotionLayout.addTransitionListener(object : TransitionAdapter() { override fun onTransitionChange( motionLayout: MotionLayout?,