feat: elevate miniplayer background color for better distinguishability

This commit is contained in:
Bnyro 2023-09-08 17:04:25 +02:00
parent 2874254496
commit 82513909d0
2 changed files with 9 additions and 1 deletions

View File

@ -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?,

View File

@ -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?,