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

Commit 9b4f002a authored by Behnam Heydarshahi's avatar Behnam Heydarshahi
Browse files

Set inactive track color for dual icon slider

Bug: 427250147
Flag: com.android.systemui.flashlight_strength
Test: manual. Open flashlight slider on light mode, track should be distinguishable from dialog background.
Change-Id: Ia7aa3f1c12bda2368ff8ba1b8de093ec784223c8
parent c0bba90f
Loading
Loading
Loading
Loading
+4 −0
Original line number 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.fillMaxWidth
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.flashlight.ui.viewmodel.FlashlightSliderViewModel
import com.android.systemui.util.ui.compose.DualIconSlider
import com.android.systemui.util.ui.compose.defaultColors

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

    // 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
@@ -234,7 +234,7 @@ object SliderMotionTestKeys {
}

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