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

Commit 5648f345 authored by Alexandr Shabalin's avatar Alexandr Shabalin Committed by Android (Google) Code Review
Browse files

Merge "Change opacity of Output Switcher disabled items to meet a11y standards." into main

parents c3cfc7ba c46f9b06
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,9 @@
    <!-- Height of the background gradient behind the screenshot UI (taller in dark mode) -->
    <!-- Height of the background gradient behind the screenshot UI (taller in dark mode) -->
    <dimen name="screenshot_bg_protection_height">375dp</dimen>
    <dimen name="screenshot_bg_protection_height">375dp</dimen>


    <!-- Output switcher panel related dimensions -->
    <item name="media_output_item_disabled_alpha" format="float" type="dimen">0.5</item>

    <!-- Accessibility floating menu -->
    <!-- Accessibility floating menu -->
    <dimen name="accessibility_floating_menu_stroke_width">1dp</dimen>
    <dimen name="accessibility_floating_menu_stroke_width">1dp</dimen>
    <dimen name="accessibility_floating_menu_stroke_inset">-2dp</dimen>
    <dimen name="accessibility_floating_menu_stroke_inset">-2dp</dimen>
+1 −0
Original line number Original line Diff line number Diff line
@@ -1649,6 +1649,7 @@
    <dimen name="media_output_item_icon_padding">12dp</dimen>
    <dimen name="media_output_item_icon_padding">12dp</dimen>
    <dimen name="media_output_item_expand_icon_width">28dp</dimen>
    <dimen name="media_output_item_expand_icon_width">28dp</dimen>
    <dimen name="media_output_item_expand_icon_height">20dp</dimen>
    <dimen name="media_output_item_expand_icon_height">20dp</dimen>
    <item name="media_output_item_disabled_alpha" format="float" type="dimen">0.6</item>


    <!-- Distance that the full shade transition takes in order to complete by tapping on a button
    <!-- Distance that the full shade transition takes in order to complete by tapping on a button
         like "expand". -->
         like "expand". -->
+6 −5
Original line number Original line Diff line number Diff line
@@ -166,6 +166,9 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
                R.dimen.media_output_item_content_vertical_margin_active
                R.dimen.media_output_item_content_vertical_margin_active
            )
            )


        private val mDisabledContentAlpha =
            mContext.resources.getFloat(R.dimen.media_output_item_disabled_alpha)

        private val mButtonRippleBackground =
        private val mButtonRippleBackground =
            AppCompatResources.getDrawable(
            AppCompatResources.getDrawable(
                mContext,
                mContext,
@@ -212,8 +215,8 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
            deviceStatusIcon: Drawable?,
            deviceStatusIcon: Drawable?,
        ) {
        ) {
            val fixedVolumeConnected = connectionState == CONNECTED && restrictVolumeAdjustment
            val fixedVolumeConnected = connectionState == CONNECTED && restrictVolumeAdjustment
            val colorTheme = ColorTheme(fixedVolumeConnected, deviceDisabled)
            val contentAlpha = if (deviceDisabled) mDisabledContentAlpha else DEVICE_ACTIVE_ALPHA

            val colorTheme = ColorTheme(fixedVolumeConnected, contentAlpha)
            updateItemBackground()
            updateItemBackground()
            updateTitle(device.name, connectionState, colorTheme)
            updateTitle(device.name, connectionState, colorTheme)
            updateTitleIcon(device, connectionState, restrictVolumeAdjustment, colorTheme)
            updateTitleIcon(device, connectionState, restrictVolumeAdjustment, colorTheme)
@@ -663,7 +666,7 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :


    private inner class ColorTheme(
    private inner class ColorTheme(
        isConnectedWithFixedVolume: Boolean = false,
        isConnectedWithFixedVolume: Boolean = false,
        deviceDisabled: Boolean = false,
        val contentAlpha: Float = DEVICE_ACTIVE_ALPHA,
    ) {
    ) {
        private val colorScheme: MediaOutputColorScheme = mController.colorScheme
        private val colorScheme: MediaOutputColorScheme = mController.colorScheme


@@ -696,12 +699,10 @@ class MediaOutputAdapter(controller: MediaSwitchingController) :
        val sliderInactiveColor = colorScheme.getSecondaryContainer()
        val sliderInactiveColor = colorScheme.getSecondaryContainer()
        val sliderInactiveIconColor = colorScheme.getOnSurface()
        val sliderInactiveIconColor = colorScheme.getOnSurface()
        val containerRestrictedVolumeBackground = colorScheme.getPrimary()
        val containerRestrictedVolumeBackground = colorScheme.getPrimary()
        val contentAlpha = if (deviceDisabled) DEVICE_DISABLED_ALPHA else DEVICE_ACTIVE_ALPHA
    }
    }


    companion object {
    companion object {
        private const val TAG = "MediaOutputAdapter"
        private const val TAG = "MediaOutputAdapter"
        private const val DEVICE_DISABLED_ALPHA = 0.5f
        private const val DEVICE_ACTIVE_ALPHA = 1f
        private const val DEVICE_ACTIVE_ALPHA = 1f
        private const val NO_VOLUME_SET = -1
        private const val NO_VOLUME_SET = -1
    }
    }