Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9694c7eb authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Set inactive track color for dual icon slider" into main

parents a115fde3 9b4f002a
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -18,11 +18,13 @@ package com.android.systemui.flashlight.ui.composable


import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.Modifier
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.flashlight.ui.viewmodel.FlashlightSliderViewModel
import com.android.systemui.flashlight.ui.viewmodel.FlashlightSliderViewModel
import com.android.systemui.util.ui.compose.DualIconSlider
import com.android.systemui.util.ui.compose.DualIconSlider
import com.android.systemui.util.ui.compose.defaultColors


@Composable
@Composable
fun FlashlightSliderContainer(viewModel: FlashlightSliderViewModel, modifier: Modifier = Modifier) {
fun FlashlightSliderContainer(viewModel: FlashlightSliderViewModel, modifier: Modifier = Modifier) {
@@ -41,6 +43,8 @@ fun FlashlightSliderContainer(viewModel: FlashlightSliderViewModel, modifier: Mo
            iconResProvider = FlashlightSliderViewModel::getIconForPercentage,
            iconResProvider = FlashlightSliderViewModel::getIconForPercentage,
            imageLoader = viewModel::loadImage,
            imageLoader = viewModel::loadImage,
            hapticsViewModelFactory = viewModel.hapticsViewModelFactory,
            hapticsViewModelFactory = viewModel.hapticsViewModelFactory,
            colors =
                defaultColors().copy(inactiveTrackColor = MaterialTheme.colorScheme.surfaceDim),
            onDrag = viewModel::setFlashlightLevel,
            onDrag = viewModel::setFlashlightLevel,
            isEnabled = viewModel.isFlashlightAdjustable,
            isEnabled = viewModel.isFlashlightAdjustable,
        )
        )
+2 −2
Original line number Original line Diff line number Diff line
@@ -100,6 +100,7 @@ fun DualIconSlider(
    iconResProvider: (Float) -> Int,
    iconResProvider: (Float) -> Int,
    imageLoader: suspend (Int, Context) -> Icon.Loaded,
    imageLoader: suspend (Int, Context) -> Icon.Loaded,
    hapticsViewModelFactory: SliderHapticsViewModel.Factory,
    hapticsViewModelFactory: SliderHapticsViewModel.Factory,
    colors: SliderColors = defaultColors(),
    onDrag: (Int) -> Unit = {},
    onDrag: (Int) -> Unit = {},
    onStop: (Int) -> Unit = {},
    onStop: (Int) -> Unit = {},
    modifier: Modifier = Modifier,
    modifier: Modifier = Modifier,
@@ -124,7 +125,6 @@ fun DualIconSlider(
                SeekableSliderTrackerConfig(),
                SeekableSliderTrackerConfig(),
            )
            )
        }
        }
    val colors = colors()


    // The value state is recreated every time gammaValue changes, so we recreate this derivedState
    // The value state is recreated every time gammaValue changes, so we recreate this derivedState
    // We have to use value as that's the value that changes when the user is dragging (gammaValue
    // We have to use value as that's the value that changes when the user is dragging (gammaValue
@@ -234,7 +234,7 @@ object SliderMotionTestKeys {
}
}


@Composable
@Composable
private fun colors(): SliderColors {
fun defaultColors(): SliderColors {
    return SliderDefaults.colors()
    return SliderDefaults.colors()
        .copy(
        .copy(
            inactiveTrackColor = LocalAndroidColorScheme.current.surfaceEffect1,
            inactiveTrackColor = LocalAndroidColorScheme.current.surfaceEffect1,