Skip to content

Commit

Permalink
refactor: Clean Icons code
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Oct 31, 2024
1 parent 116fed9 commit dbf2665
Show file tree
Hide file tree
Showing 12 changed files with 209 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.coerceAtLeast
import androidx.compose.ui.unit.dp
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages
import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons
import com.infomaniak.swisstransfer.ui.images.icons.CrossThick
import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
Expand All @@ -55,7 +55,7 @@ fun BoxScope.CrossCircleButton(onClick: (() -> Unit)?, size: Dp = 48.dp) {
) {
Icon(
modifier = Modifier.size(Margin.Mini),
imageVector = AppImages.AppIcons.CrossThick,
imageVector = AppIcons.CrossThick,
contentDescription = stringResource(R.string.contentDescriptionButtonRemove),
tint = Color.White,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.swisstransfer.ui.images.icons

import androidx.compose.foundation.Image
Expand All @@ -20,15 +37,15 @@ import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRoun

val AppIcons.AddThick: ImageVector
get() {
if (_addThick != null) {
return _addThick!!
}

if (_addThick != null) return _addThick!!

_addThick = Builder(
name = "AddThick",
defaultWidth = 24.0.dp,
defaultHeight = 24.0.dp,
viewportWidth = 16.0f,
viewportHeight = 16.0f
viewportHeight = 16.0f,
).apply {
path(
fill = null,
Expand All @@ -37,14 +54,15 @@ val AppIcons.AddThick: ImageVector
strokeLineCap = strokeCapRound,
strokeLineJoin = strokeJoinRound,
strokeLineMiter = 4.0f,
pathFillType = NonZero
pathFillType = NonZero,
) {
moveTo(1.0f, 8.0f)
horizontalLineToRelative(14.0f)
moveTo(8.0f, 1.0f)
verticalLineToRelative(14.0f)
}
}.build()

return _addThick!!
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.swisstransfer.ui.images.icons

import androidx.compose.foundation.Image
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.swisstransfer.ui.images.icons

import androidx.compose.foundation.Image
Expand All @@ -20,6 +37,7 @@ import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRoun

val AppIcons.Chain: ImageVector
get() {

if (_chain != null) return _chain!!

_chain = Builder(
Expand Down Expand Up @@ -51,7 +69,7 @@ val AppIcons.Chain: ImageVector
strokeLineCap = strokeCapRound,
strokeLineJoin = strokeJoinRound,
strokeLineMiter = 4.0f,
pathFillType = NonZero
pathFillType = NonZero,
) {
moveTo(14.82f, 6.194f)
lineToRelative(0.75f, -0.75f)
Expand All @@ -60,6 +78,7 @@ val AppIcons.Chain: ImageVector
arcToRelative(4.5f, 4.5f, 0.0f, false, true, -6.824f, -5.826f)
}
}.build()

return _chain!!
}

Expand All @@ -72,7 +91,7 @@ private fun Preview() {
Image(
imageVector = AppIcons.Chain,
contentDescription = null,
modifier = Modifier.size(AppImages.previewSize)
modifier = Modifier.size(AppImages.previewSize),
)
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.swisstransfer.ui.images.icons

import androidx.compose.foundation.Image
Expand All @@ -14,20 +31,21 @@ import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.infomaniak.swisstransfer.ui.images.AppImages
import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons
import androidx.compose.ui.graphics.StrokeCap.Companion.Round as strokeCapRound
import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRound

val AppImages.AppIcons.CrossThick: ImageVector
val AppIcons.CrossThick: ImageVector
get() {
if (_crossThick != null) {
return _crossThick!!
}

if (_crossThick != null) return _crossThick!!

_crossThick = Builder(
name = "CrossThick",
defaultWidth = 16.0.dp,
defaultHeight = 16.0.dp,
viewportWidth = 16.0f,
viewportHeight = 16.0f
viewportHeight = 16.0f,
).apply {
path(
fill = null,
Expand All @@ -44,6 +62,7 @@ val AppImages.AppIcons.CrossThick: ImageVector
lineTo(1.0f, 1.0f)
}
}.build()

return _crossThick!!
}

Expand All @@ -54,9 +73,9 @@ private var _crossThick: ImageVector? = null
private fun Preview() {
Box {
Image(
imageVector = AppImages.AppIcons.CrossThick,
imageVector = AppIcons.CrossThick,
contentDescription = null,
modifier = Modifier.size(AppImages.previewSize)
modifier = Modifier.size(AppImages.previewSize),
)
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.swisstransfer.ui.images.icons

import androidx.compose.foundation.Image
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.swisstransfer.ui.images.icons

import androidx.compose.foundation.Image
Expand All @@ -20,6 +37,7 @@ import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRoun

val AppIcons.Envelope: ImageVector
get() {

if (_envelope != null) return _envelope!!

_envelope = Builder(
Expand Down Expand Up @@ -59,6 +77,7 @@ val AppIcons.Envelope: ImageVector
lineToRelative(8.618f, -6.375f)
}
}.build()

return _envelope!!
}

Expand All @@ -69,7 +88,9 @@ private var _envelope: ImageVector? = null
private fun Preview() {
Box {
Image(
imageVector = AppIcons.Envelope, contentDescription = null, modifier = Modifier.size(AppImages.previewSize)
imageVector = AppIcons.Envelope,
contentDescription = null,
modifier = Modifier.size(AppImages.previewSize),
)
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.swisstransfer.ui.images.icons

import androidx.compose.foundation.Image
Expand All @@ -22,14 +39,15 @@ import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRoun

val AppIcons.LockedTextField: ImageVector
get() {

if (_lockedTextField != null) return _lockedTextField!!

_lockedTextField = Builder(
name = "LockedTextField",
defaultWidth = 24.0.dp,
defaultHeight = 24.0.dp,
viewportWidth = 24.0f,
viewportHeight = 25.0f
viewportHeight = 25.0f,
).apply {
group {
path(fill = SolidColor(Color(0xFF9F9F9F)), pathFillType = EvenOdd) {
Expand Down Expand Up @@ -117,6 +135,7 @@ val AppIcons.LockedTextField: ImageVector
}
}
}.build()

return _lockedTextField!!
}

Expand All @@ -129,7 +148,7 @@ private fun Preview() {
Image(
imageVector = AppIcons.LockedTextField,
contentDescription = null,
modifier = Modifier.size(AppImages.previewSize)
modifier = Modifier.size(AppImages.previewSize),
)
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.swisstransfer.ui.images.icons

import androidx.compose.foundation.Image
Expand Down
Loading

0 comments on commit dbf2665

Please sign in to comment.