From 03657438a10134f1c093be218ba8e2b945f4c975 Mon Sep 17 00:00:00 2001 From: Florent Maitre Date: Tue, 3 Dec 2024 18:23:30 +0100 Subject: [PATCH] Review: Remove useless extension method on Color --- .../ouds/core/component/icon/OudsIcon.kt | 8 +++----- .../orange/ouds/core/extensions/ColorExt.kt | 19 ------------------- 2 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 core/src/main/java/com/orange/ouds/core/extensions/ColorExt.kt diff --git a/core/src/main/java/com/orange/ouds/core/component/icon/OudsIcon.kt b/core/src/main/java/com/orange/ouds/core/component/icon/OudsIcon.kt index 8c44ef8a..e7260911 100644 --- a/core/src/main/java/com/orange/ouds/core/component/icon/OudsIcon.kt +++ b/core/src/main/java/com/orange/ouds/core/component/icon/OudsIcon.kt @@ -19,7 +19,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.vector.ImageVector -import com.orange.ouds.core.extensions.enabled @Composable internal fun OudsIcon( @@ -29,11 +28,10 @@ internal fun OudsIcon( tint: Color = OudsIconDefaults.tint, enabled: Boolean = true, ) { - val iconTint = tint.enabled(enabled = enabled) when (graphicsObject) { - is Painter -> Icon(painter = graphicsObject, contentDescription = contentDescription, modifier = modifier, tint = iconTint) - is ImageVector -> Icon(imageVector = graphicsObject, contentDescription = contentDescription, modifier = modifier, tint = iconTint) - is ImageBitmap -> Icon(bitmap = graphicsObject, contentDescription = contentDescription, modifier = modifier, tint = iconTint) + is Painter -> Icon(painter = graphicsObject, contentDescription = contentDescription, modifier = modifier, tint = tint) + is ImageVector -> Icon(imageVector = graphicsObject, contentDescription = contentDescription, modifier = modifier, tint = tint) + is ImageBitmap -> Icon(bitmap = graphicsObject, contentDescription = contentDescription, modifier = modifier, tint = tint) else -> {} } } diff --git a/core/src/main/java/com/orange/ouds/core/extensions/ColorExt.kt b/core/src/main/java/com/orange/ouds/core/extensions/ColorExt.kt deleted file mode 100644 index d9b5ac02..00000000 --- a/core/src/main/java/com/orange/ouds/core/extensions/ColorExt.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Software Name: OUDS Android - * SPDX-FileCopyrightText: Copyright (c) Orange SA - * SPDX-License-Identifier: MIT - * - * This software is distributed under the MIT license, - * the text of which is available at https://opensource.org/license/MIT/ - * or see the "LICENSE" file for more details. - * - * Software description: Android library of reusable graphical components - */ - -package com.orange.ouds.core.extensions - -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color - -@Composable -internal fun Color.enabled(enabled: Boolean) = if (enabled) this else copy(alpha = 0.38f)