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

Commit 16af8bef authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Migrate from painterResource to ImageVector

Also reduce the weight and size of the icon

Test: manually
Flag: com.android.systemui.qs_ui_refactor_compose_fragment
Bug: 406799422
Change-Id: I5d66eb6db8a7a9745d1b827908d49b84928384cc
parent 13601812
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2025 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:tint="?attr/colorControlNormal"
    android:viewportHeight="960"
    android:viewportWidth="960">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M480,604.5Q471.04,604.5 462.85,601.4Q454.65,598.3 447.93,591.59L264.17,407.83Q251.5,395.15 251.5,376Q251.5,356.85 264.17,344.17Q276.85,331.5 296,331.5Q315.15,331.5 327.83,344.17L480,496.35L632.17,344.17Q644.85,331.5 664,331.5Q683.15,331.5 695.83,344.17Q708.5,356.85 708.5,376Q708.5,395.15 695.83,407.83L512.07,591.59Q505.35,598.3 497.15,601.4Q488.96,604.5 480,604.5Z" />
</vector>
 No newline at end of file
+77 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.qs.panels.ui.compose.icons

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp

public val DualTargetArrow: ImageVector
    get() {
        if (_DualTargetArrow != null) {
            return _DualTargetArrow!!
        }
        _DualTargetArrow =
            ImageVector.Builder(
                    name = "DualTargetArrow",
                    defaultWidth = 24.dp,
                    defaultHeight = 24.dp,
                    viewportWidth = 960f,
                    viewportHeight = 960f,
                )
                .apply {
                    path(
                        fill = SolidColor(Color(0xFFFFFFFF)),
                        fillAlpha = 1.0f,
                        stroke = null,
                        strokeAlpha = 1.0f,
                        strokeLineWidth = 1.0f,
                        strokeLineCap = StrokeCap.Butt,
                        strokeLineJoin = StrokeJoin.Miter,
                        strokeLineMiter = 1.0f,
                        pathFillType = PathFillType.NonZero,
                    ) {
                        moveTo(480f, 599f)
                        quadTo(472f, 599f, 465f, 596.5f)
                        quadTo(458f, 594f, 452f, 588f)
                        lineTo(268f, 404f)
                        quadTo(257f, 393f, 257f, 376f)
                        quadTo(257f, 359f, 268f, 348f)
                        quadTo(279f, 337f, 296f, 337f)
                        quadTo(313f, 337f, 324f, 348f)
                        lineTo(480f, 504f)
                        lineTo(636f, 348f)
                        quadTo(647f, 337f, 664f, 337f)
                        quadTo(681f, 337f, 692f, 348f)
                        quadTo(703f, 359f, 703f, 376f)
                        quadTo(703f, 393f, 692f, 404f)
                        lineTo(508f, 588f)
                        quadTo(502f, 594f, 495f, 596.5f)
                        quadTo(488f, 599f, 480f, 599f)
                        close()
                    }
                }
                .build()
        return _DualTargetArrow!!
    }

private var _DualTargetArrow: ImageVector? = null
+4 −4
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ import androidx.compose.ui.graphics.ColorProducer
import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.clearAndSetSemantics
@@ -88,6 +87,7 @@ import com.android.systemui.common.shared.model.Icon
import com.android.systemui.common.ui.compose.Icon
import com.android.systemui.common.ui.compose.load
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.qs.panels.ui.compose.icons.DualTargetArrow
import com.android.systemui.qs.panels.ui.compose.infinitegrid.CommonTileDefaults.ChevronSize
import com.android.systemui.qs.panels.ui.compose.infinitegrid.CommonTileDefaults.SideIconHeight
import com.android.systemui.qs.panels.ui.compose.infinitegrid.CommonTileDefaults.SideIconWidth
@@ -185,9 +185,9 @@ fun LargeTileContent(
            )
        } else if (isDualTarget) {
            Icon(
                painterResource(R.drawable.ic_qs_dual_target_arrow),
                DualTargetArrow,
                contentDescription = null,
                tint = { colors.label },
                tint = colors.label,
                modifier = Modifier.size(ChevronSize),
            )
        }
@@ -368,7 +368,7 @@ object CommonTileDefaults {
    val LargeTileIconSize = 28.dp
    val SideIconWidth = 32.dp
    val SideIconHeight = 20.dp
    val ChevronSize = 16.dp
    val ChevronSize = 14.dp
    val ToggleTargetSize = 56.dp
    val TileHeight = 72.dp
    val TileStartPadding = 8.dp