From d289110a5d2ad7f3750049d860655caf1c42f1e6 Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Wed, 21 Aug 2024 16:30:17 +0200 Subject: [PATCH 1/8] Add url in strings and handle external action --- .../ui/screen/main/settings/SettingsScreen.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt index 4c526d6a4..75345524c 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt @@ -18,6 +18,12 @@ package com.infomaniak.swisstransfer.ui.screen.main.settings +import android.content.ActivityNotFoundException +import android.content.Context +import android.content.Intent +import android.net.Uri +import android.os.Build +import android.provider.Settings import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize @@ -65,6 +71,9 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewTablet fun SettingsScreenWrapper( windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo(), ) { + val context = LocalContext.current + val aboutURL = stringResource(R.string.urlAbout) + val userReportURL = stringResource(R.string.urlUserReportAndroid) TwoPaneScaffold( windowAdaptiveInfo, listPane = { ListPane(this) }, From cff9f3440cee3a2d1bf01e2f86db23051c2c086e Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Thu, 22 Aug 2024 08:27:34 +0200 Subject: [PATCH 2/8] Add email language settings UI --- .../ui/icons/illu/EnglishFlag.kt | 196 ++ .../swisstransfer/ui/icons/illu/FrenchFlag.kt | 104 + .../swisstransfer/ui/icons/illu/GermanFlag.kt | 86 + .../ui/icons/illu/ItalianFlag.kt | 88 + .../SettingsDurationValidityScreen.kt | 3 +- .../settings/SettingsEmailLanguageScreen.kt | 75 + .../ui/screen/main/settings/SettingsScreen.kt | 5 +- .../main/settings/SettingsThemeScreen.kt | 6 +- .../components/SingleSelectOptions.kt | 8 +- app/src/main/res/drawable/flag_es.xml | 2213 +++++++++++++++++ app/src/main/res/values-de/strings.xml | 6 + app/src/main/res/values-es/strings.xml | 6 + app/src/main/res/values-fr/strings.xml | 6 + app/src/main/res/values-it/strings.xml | 6 + app/src/main/res/values/strings.xml | 6 + 15 files changed, 2807 insertions(+), 7 deletions(-) create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt create mode 100644 app/src/main/res/drawable/flag_es.xml diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt new file mode 100644 index 000000000..fb935b1d0 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt @@ -0,0 +1,196 @@ +package com.infomaniak.swisstransfer.ui.icons.illu + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.group +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.icons.AppIcons + +val AppIcons.EnglishFlag: ImageVector + get() { + if (_englishFlag != null) { + return _englishFlag!! + } + _englishFlag = Builder( + name = "EnglishFlag", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f + ).apply { + group { + path( + fill = SolidColor(Color(0xFF0B5394)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(1.333f, 3.0f) + horizontalLineToRelative(21.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) + verticalLineToRelative(15.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 22.667f, 21.0f) + horizontalLineTo(1.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.667f) + verticalLineTo(4.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(12.0f, 11.667f) + lineTo(24.0f, 3.0f) + verticalLineToRelative(3.333f) + lineToRelative(-6.667f, 4.0f) + close() + } + path( + fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(14.667f, 10.334f) + lineTo(24.0f, 3.667f) + verticalLineTo(5.0f) + lineToRelative(-8.0f, 5.334f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(12.0f, 13.667f) + lineTo(0.0f, 22.334f) + verticalLineToRelative(-3.333f) + lineToRelative(6.667f, -4.0f) + close() + } + path( + fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(9.333f, 15.0f) + lineTo(0.0f, 21.667f) + verticalLineToRelative(-1.333f) + lineTo(8.0f, 15.0f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(12.0f, 11.667f) + lineTo(0.0f, 3.0f) + verticalLineToRelative(3.333f) + lineToRelative(6.667f, 4.0f) + close() + } + path( + fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(9.333f, 10.334f) + lineTo(0.0f, 3.667f) + verticalLineTo(5.0f) + lineToRelative(8.0f, 5.334f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(12.0f, 13.667f) + lineToRelative(12.0f, 8.667f) + verticalLineToRelative(-3.333f) + lineToRelative(-6.667f, -4.0f) + close() + } + path( + fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(14.667f, 15.0f) + lineTo(24.0f, 21.667f) + verticalLineToRelative(-1.333f) + lineTo(16.0f, 15.0f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(0.0f, 15.0f) + verticalLineTo(9.667f) + horizontalLineToRelative(24.0f) + verticalLineTo(15.0f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(9.333f, 3.0f) + horizontalLineToRelative(5.333f) + verticalLineToRelative(18.667f) + horizontalLineTo(9.333f) + close() + } + path( + fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(10.667f, 3.0f) + horizontalLineToRelative(2.667f) + verticalLineToRelative(18.667f) + horizontalLineToRelative(-2.667f) + close() + } + path( + fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(0.0f, 13.667f) + verticalLineTo(11.0f) + horizontalLineToRelative(24.0f) + verticalLineToRelative(2.667f) + close() + } + } + } + .build() + return _englishFlag!! + } + +private var _englishFlag: ImageVector? = null + +@Preview +@Composable +private fun Preview() { + Box(modifier = Modifier.padding(12.dp)) { + Image(imageVector = AppIcons.EnglishFlag, contentDescription = "") + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt new file mode 100644 index 000000000..860625789 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt @@ -0,0 +1,104 @@ +package com.infomaniak.swisstransfer.ui.icons.illu + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.group +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.icons.AppIcons + +val AppIcons.FrenchFlag: ImageVector + get() { + if (_frenchFlag != null) { + return _frenchFlag!! + } + _frenchFlag = Builder( + name = "FrenchFlag", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f + ).apply { + group { + path( + fill = SolidColor(Color(0xFF0B5394)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(1.333f, 3.0f) + horizontalLineToRelative(21.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) + verticalLineToRelative(15.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 22.667f, 21.0f) + horizontalLineTo(1.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.667f) + verticalLineTo(4.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) + close() + } + path( + fill = SolidColor(Color(0xFFE70E0E)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(1.333f, 3.0f) + horizontalLineToRelative(21.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) + verticalLineToRelative(16.001f) + arcToRelative(1.333f, 1.333f, 0.0f, false, true, -1.333f, 1.333f) + horizontalLineTo(1.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.334f) + verticalLineTo(4.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) + close() + } + path( + fill = SolidColor(Color(0xFF0B5394)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(0.0f, 4.333f) + curveTo(0.0f, 3.597f, 0.597f, 3.0f, 1.333f, 3.0f) + horizontalLineTo(8.0f) + verticalLineToRelative(18.667f) + horizontalLineTo(1.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.333f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(8.0f, 3.0f) + horizontalLineToRelative(8.0f) + verticalLineToRelative(18.667f) + horizontalLineTo(8.0f) + close() + } + } + } + .build() + return _frenchFlag!! + } + +private var _frenchFlag: ImageVector? = null + +@Preview +@Composable +private fun Preview() { + Box(modifier = Modifier.padding(12.dp)) { + Image(imageVector = AppIcons.FrenchFlag, contentDescription = "") + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt new file mode 100644 index 000000000..90ca661a8 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt @@ -0,0 +1,86 @@ +package com.infomaniak.swisstransfer.ui.icons.illu + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.group +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.icons.AppIcons + +val AppIcons.GermanFlag: ImageVector + get() { + if (_germanFlag != null) { + return _germanFlag!! + } + _germanFlag = Builder( + name = "GermanFlag", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f + ).apply { + group { + path( + fill = SolidColor(Color(0xFFE70E0E)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(1.333f, 3.0f) + horizontalLineToRelative(21.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) + verticalLineToRelative(15.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 22.667f, 21.0f) + horizontalLineTo(1.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.667f) + verticalLineTo(4.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) + close() + } + path( + fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(0.0f, 3.0f) + horizontalLineToRelative(24.0f) + verticalLineToRelative(6.0f) + horizontalLineTo(0.0f) + close() + } + path( + fill = SolidColor(Color(0xFFFDDA25)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(0.0f, 15.667f) + horizontalLineToRelative(24.0f) + verticalLineToRelative(6.0f) + horizontalLineTo(0.0f) + close() + } + } + } + .build() + return _germanFlag!! + } + +private var _germanFlag: ImageVector? = null + +@Preview +@Composable +private fun Preview() { + Box(modifier = Modifier.padding(12.dp)) { + Image(imageVector = AppIcons.GermanFlag, contentDescription = "") + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt new file mode 100644 index 000000000..37dca29be --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt @@ -0,0 +1,88 @@ +package com.infomaniak.swisstransfer.ui.icons.illu + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap.Companion.Butt +import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.group +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.icons.AppIcons + +val AppIcons.ItalianFlag: ImageVector + get() { + if (_italianFlag != null) { + return _italianFlag!! + } + _italianFlag = Builder( + name = "ItalianFlag", + defaultWidth = 24.0.dp, + defaultHeight = 24.0.dp, + viewportWidth = 24.0f, + viewportHeight = 24.0f + ).apply { + group { + path( + fill = SolidColor(Color(0xFFE70E0E)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(1.333f, 3.0f) + horizontalLineToRelative(21.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) + verticalLineToRelative(15.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 22.667f, 21.0f) + horizontalLineTo(1.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.667f) + verticalLineTo(4.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) + close() + } + path( + fill = SolidColor(Color(0xFF128D4E)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(0.0f, 4.333f) + curveTo(0.0f, 3.597f, 0.597f, 3.0f, 1.333f, 3.0f) + horizontalLineTo(8.0f) + verticalLineToRelative(18.667f) + horizontalLineTo(1.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.333f) + close() + } + path( + fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = + 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = + 4.0f, pathFillType = NonZero + ) { + moveTo(8.0f, 3.0f) + horizontalLineToRelative(8.0f) + verticalLineToRelative(18.667f) + horizontalLineTo(8.0f) + close() + } + } + } + .build() + return _italianFlag!! + } + +private var _italianFlag: ImageVector? = null + +@Preview +@Composable +private fun Preview() { + Box(modifier = Modifier.padding(12.dp)) { + Image(imageVector = AppIcons.ItalianFlag, contentDescription = "") + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDurationValidityScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDurationValidityScreen.kt index f61d89bc6..f2cedc951 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDurationValidityScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDurationValidityScreen.kt @@ -48,7 +48,8 @@ fun SettingsValidityPeriodScreen() { enum class ValidityPeriod( override val title: @Composable () -> String, - override val icon: ImageVector? = null + override val imageVector: ImageVector? = null, + override val imageVectorResId: Int? = null, ) : SettingOption { THIRTY({ pluralStringResource(R.plurals.settingsValidityPeriodValue, 30, 30) }), FIFTEEN({ pluralStringResource(R.plurals.settingsValidityPeriodValue, 15, 15) }), diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt new file mode 100644 index 000000000..daaa1b6ee --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt @@ -0,0 +1,75 @@ +/* + * 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 . + */ + +package com.infomaniak.swisstransfer.ui.screen.main.settings + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Surface +import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource +import com.infomaniak.swisstransfer.R +import com.infomaniak.swisstransfer.ui.icons.AppIcons +import com.infomaniak.swisstransfer.ui.icons.illu.EnglishFlag +import com.infomaniak.swisstransfer.ui.icons.illu.FrenchFlag +import com.infomaniak.swisstransfer.ui.icons.illu.GermanFlag +import com.infomaniak.swisstransfer.ui.icons.illu.ItalianFlag +import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingOption +import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingTitle +import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SingleSelectOptions +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme +import com.infomaniak.swisstransfer.ui.utils.PreviewMobile +import com.infomaniak.swisstransfer.ui.utils.PreviewTablet + +@Composable +fun SettingsEmailLanguageScreen() { + Column(modifier = Modifier.verticalScroll(rememberScrollState())) { + SettingTitle(titleRes = R.string.settingsEmailLanguageTitle) + + val (selectedItem, setSelectedItem) = rememberSaveable { mutableIntStateOf(0) } // TODO: Use DataStore or Realm + SingleSelectOptions(EmailLanguage.entries, { selectedItem }, setSelectedItem) + } +} + +enum class EmailLanguage( + override val title: @Composable () -> String, + override val imageVector: ImageVector? = null, + override val imageVectorResId: Int? = null +) : SettingOption { + ENGLISH({ stringResource(R.string.settingsEmailLanguageValueEnglish) }, imageVector = AppIcons.EnglishFlag), + FRENCH({ stringResource(R.string.settingsEmailLanguageValueFrench) }, imageVector = AppIcons.FrenchFlag), + GERMAN({ stringResource(R.string.settingsEmailLanguageValueGerman) }, imageVector = AppIcons.GermanFlag), + ITALIAN({ stringResource(R.string.settingsEmailLanguageValueItalian) }, imageVector = AppIcons.ItalianFlag), + SPANISH({ stringResource(R.string.settingsEmailLanguageValueSpanish) }, imageVectorResId = R.drawable.flag_es), +} + +@PreviewMobile +@PreviewTablet +@Composable +private fun SettingsThemeScreenPreview() { + SwissTransferTheme { + Surface { + SettingsEmailLanguageScreen() + } + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt index 75345524c..854e3acc4 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt @@ -71,9 +71,6 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewTablet fun SettingsScreenWrapper( windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo(), ) { - val context = LocalContext.current - val aboutURL = stringResource(R.string.urlAbout) - val userReportURL = stringResource(R.string.urlUserReportAndroid) TwoPaneScaffold( windowAdaptiveInfo, listPane = { ListPane(this) }, @@ -117,7 +114,7 @@ private fun DetailPane(navigator: ThreePaneScaffoldNavigator SettingsThemeScreen() VALIDITY_PERIOD -> SettingsValidityPeriodScreen() DOWNLOAD_LIMIT -> Unit - EMAIL_LANGUAGE -> Unit + EMAIL_LANGUAGE -> SettingsEmailLanguageScreen() NOTIFICATIONS, DISCOVER_INFOMANIAK, SHARE_IDEAS, diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsThemeScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsThemeScreen.kt index f34ba7d3a..66759eb8b 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsThemeScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsThemeScreen.kt @@ -52,7 +52,11 @@ fun SettingsThemeScreen() { } } -enum class ThemeOption(override val title: @Composable () -> String, override val icon: ImageVector) : SettingOption { +enum class ThemeOption( + override val title: @Composable () -> String, + override val imageVector: ImageVector, + override val imageVectorResId: Int? = null +) : SettingOption { SYSTEM({ stringResource(R.string.settingsOptionThemeSystem) }, AppIcons.BlackAndWhiteCircle), LIGHT({ stringResource(R.string.settingsOptionThemeLight) }, AppIcons.WhiteCircle), DARK({ stringResource(R.string.settingsOptionThemeDark) }, AppIcons.BlackCircle), diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/SingleSelectOptions.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/SingleSelectOptions.kt index 8f77bfc4a..6518bc512 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/SingleSelectOptions.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/SingleSelectOptions.kt @@ -35,6 +35,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import com.infomaniak.swisstransfer.R import com.infomaniak.swisstransfer.ui.components.SharpRippleButton @@ -91,7 +92,11 @@ private fun SettingOptionItem(item: SettingOption, isSelected: Boolean, onClick: interface SettingOption { val title: @Composable () -> String + val imageVector: ImageVector? + val imageVectorResId: Int? + val icon: ImageVector? + @Composable get() = imageVector ?: imageVectorResId?.let { ImageVector.vectorResource(it) } } @Preview(name = "Light") @@ -103,7 +108,8 @@ private fun SettingOptionItemPreview() { Column { val item = object : SettingOption { override val title: @Composable () -> String = { stringResource(R.string.appName) } - override val icon: ImageVector = AppIcons.Add + override val imageVector: ImageVector = AppIcons.Add + override val imageVectorResId = null } SettingOptionItem(item, true) {} SettingOptionItem(item, false) {} diff --git a/app/src/main/res/drawable/flag_es.xml b/app/src/main/res/drawable/flag_es.xml new file mode 100644 index 000000000..43f3bf421 --- /dev/null +++ b/app/src/main/res/drawable/flag_es.xml @@ -0,0 +1,2213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 99b6685b6..643f11f3a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -31,6 +31,12 @@ General Wähle Sie eine Präferenz Entdecken Sie Infomaniak + Legt eine Standardsprache für Ihre Weiterleitungen per E-Mail fest + Englisch + Deutsch + Deutsch + Italienisch + Spanisch Limit für Downloads Sprache der E-Mail Gib deine Meinung ab diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 892c96312..312c740ce 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -29,6 +29,12 @@ Quiénes somos Ajustes por defecto General + Establecer un idioma por defecto para las transferencias de correo electrónico + Inglés + Francés + Alemán + Italiano + Español Seleccione una preferencia Descubrir Infomaniak Límite de descarga diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index fdb9f01ed..b03708575 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -29,6 +29,12 @@ A propos Paramètres par défaut Général + Défini une langue par défaut pour vos transferts par e-mail + Anglais + Francais + Allemand + Italien + Espagnol Sélectionne une préférence Découvrir Infomaniak Limite de téléchargements diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 1dcdc54d5..5c0093fa6 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -30,6 +30,12 @@ Impostazioni predefinite Generale Selezionare una preferenza + Impostare una lingua predefinita per i trasferimenti di e-mail + Inglese + Francese + Tedesco + Italiano + Spagnolo Scoprire Infomaniak Limite di download Lingua della posta elettronica diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9292bcec9..7cca02079 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -32,6 +32,12 @@ About Default settings Général + Set a default language for your email transfers + English + French + German + Italian + Spanish Select a preference Discover Infomaniak Download limit From 38508a9ffbd35811b42fed7ab32718254fecc58b Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Mon, 26 Aug 2024 17:58:15 +0200 Subject: [PATCH 3/8] Add swisstransfer exclusion for SVGs --- app/build.gradle.kts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9b2abe070..bb1eb1839 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,6 +5,7 @@ plugins { alias(libs.plugins.kapt) alias(libs.plugins.hilt) kotlin("plugin.serialization") version libs.versions.kotlin + id("org.sonarqube") version "5.1.0.4882" // Replace with latest scanner version number } val sharedMinSdk: Int by rootProject.extra @@ -52,6 +53,12 @@ android { excludes += "/META-INF/{AL2.0,LGPL2.1}" } } + sonarqube { + properties { + property("sonar.sources", "src/main/java/com/infomaniak/swisstransfer") + property("sonar.exclusions", "src/main/java/com/infomaniak/swisstransfer/ui/icons/**") + } + } } kapt { From 2766a33a144a106c0289bea8c4ade839c8a8f5fa Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Mon, 26 Aug 2024 18:31:04 +0200 Subject: [PATCH 4/8] Remove sonarqube plugin --- app/build.gradle.kts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bb1eb1839..9b2abe070 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,7 +5,6 @@ plugins { alias(libs.plugins.kapt) alias(libs.plugins.hilt) kotlin("plugin.serialization") version libs.versions.kotlin - id("org.sonarqube") version "5.1.0.4882" // Replace with latest scanner version number } val sharedMinSdk: Int by rootProject.extra @@ -53,12 +52,6 @@ android { excludes += "/META-INF/{AL2.0,LGPL2.1}" } } - sonarqube { - properties { - property("sonar.sources", "src/main/java/com/infomaniak/swisstransfer") - property("sonar.exclusions", "src/main/java/com/infomaniak/swisstransfer/ui/icons/**") - } - } } kapt { From 2d25b6dae01c431ad5a6d8de4e6f911a93152cf3 Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Tue, 27 Aug 2024 08:08:07 +0200 Subject: [PATCH 5/8] Add sonar-project.properties --- sonar-project.properties | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..40808de5d --- /dev/null +++ b/sonar-project.properties @@ -0,0 +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 . +# + +sonar.sources = . +sonar.exclusions = ./app/src/main/java/com/infomaniak/swisstransfer/ui/icons From e4be142e9fe349124e2bfe3231aaf74a4fc89fe6 Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Tue, 27 Aug 2024 08:54:41 +0200 Subject: [PATCH 6/8] Remove useless sonar config file --- sonar-project.properties | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index 40808de5d..000000000 --- a/sonar-project.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# 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 . -# - -sonar.sources = . -sonar.exclusions = ./app/src/main/java/com/infomaniak/swisstransfer/ui/icons From 2a213679942a748f395d52ba6ebe3dc88028c765 Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Tue, 27 Aug 2024 10:40:45 +0200 Subject: [PATCH 7/8] Fix flags --- .../ui/icons/illu/EnglishFlag.kt | 31 ++++++++++++++----- .../swisstransfer/ui/icons/illu/FrenchFlag.kt | 7 ++++- .../swisstransfer/ui/icons/illu/GermanFlag.kt | 7 ++++- .../ui/icons/illu/ItalianFlag.kt | 14 ++++++--- 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt index fb935b1d0..28b4adea0 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt @@ -3,6 +3,7 @@ package com.infomaniak.swisstransfer.ui.icons.illu import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -12,6 +13,7 @@ import androidx.compose.ui.graphics.StrokeCap.Companion.Butt import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.PathData import androidx.compose.ui.graphics.vector.group import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.tooling.preview.Preview @@ -30,7 +32,18 @@ val AppIcons.EnglishFlag: ImageVector viewportWidth = 24.0f, viewportHeight = 24.0f ).apply { - group { + group(clipPathData = PathData { + moveTo(1.333f, 3.0f) + horizontalLineToRelative(21.334f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) + verticalLineToRelative(16.65f) + arcToRelative(1.333f, 1.333f, 0.0f, false, true, -1.333f, 1.333f) + horizontalLineTo(1.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.334f) + verticalLineTo(4.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) + close() + }) { path( fill = SolidColor(Color(0xFF0B5394)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = @@ -39,10 +52,10 @@ val AppIcons.EnglishFlag: ImageVector moveTo(1.333f, 3.0f) horizontalLineToRelative(21.334f) arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) - verticalLineToRelative(15.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 22.667f, 21.0f) + verticalLineToRelative(16.65f) + arcToRelative(1.333f, 1.333f, 0.0f, false, true, -1.333f, 1.333f) horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.667f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.334f) verticalLineTo(4.333f) arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) close() @@ -153,7 +166,7 @@ val AppIcons.EnglishFlag: ImageVector ) { moveTo(9.333f, 3.0f) horizontalLineToRelative(5.333f) - verticalLineToRelative(18.667f) + verticalLineToRelative(19.3f) horizontalLineTo(9.333f) close() } @@ -164,7 +177,7 @@ val AppIcons.EnglishFlag: ImageVector ) { moveTo(10.667f, 3.0f) horizontalLineToRelative(2.667f) - verticalLineToRelative(18.667f) + verticalLineToRelative(19.3f) horizontalLineToRelative(-2.667f) close() } @@ -191,6 +204,10 @@ private var _englishFlag: ImageVector? = null @Composable private fun Preview() { Box(modifier = Modifier.padding(12.dp)) { - Image(imageVector = AppIcons.EnglishFlag, contentDescription = "") + Image( + imageVector = AppIcons.EnglishFlag, + contentDescription = "", + modifier = Modifier.size(AppIcons.previewSize) + ) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt index 860625789..e6af17ea4 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt @@ -3,6 +3,7 @@ package com.infomaniak.swisstransfer.ui.icons.illu import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -99,6 +100,10 @@ private var _frenchFlag: ImageVector? = null @Composable private fun Preview() { Box(modifier = Modifier.padding(12.dp)) { - Image(imageVector = AppIcons.FrenchFlag, contentDescription = "") + Image( + imageVector = AppIcons.FrenchFlag, + contentDescription = "", + modifier = Modifier.size(AppIcons.previewSize) + ) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt index 90ca661a8..678fef7ce 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt @@ -3,6 +3,7 @@ package com.infomaniak.swisstransfer.ui.icons.illu import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -81,6 +82,10 @@ private var _germanFlag: ImageVector? = null @Composable private fun Preview() { Box(modifier = Modifier.padding(12.dp)) { - Image(imageVector = AppIcons.GermanFlag, contentDescription = "") + Image( + imageVector = AppIcons.GermanFlag, + contentDescription = "", + modifier = Modifier.size(AppIcons.previewSize) + ) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt index 37dca29be..a137e5de2 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt @@ -3,6 +3,7 @@ package com.infomaniak.swisstransfer.ui.icons.illu import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -16,6 +17,7 @@ import androidx.compose.ui.graphics.vector.group import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.core.graphics.translationMatrix import com.infomaniak.swisstransfer.ui.icons.AppIcons val AppIcons.ItalianFlag: ImageVector @@ -55,9 +57,9 @@ val AppIcons.ItalianFlag: ImageVector moveTo(0.0f, 4.333f) curveTo(0.0f, 3.597f, 0.597f, 3.0f, 1.333f, 3.0f) horizontalLineTo(8.0f) - verticalLineToRelative(18.667f) + verticalLineToRelative(18.0f) horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.333f) + arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.6f) close() } path( @@ -67,7 +69,7 @@ val AppIcons.ItalianFlag: ImageVector ) { moveTo(8.0f, 3.0f) horizontalLineToRelative(8.0f) - verticalLineToRelative(18.667f) + verticalLineToRelative(18.0f) horizontalLineTo(8.0f) close() } @@ -83,6 +85,10 @@ private var _italianFlag: ImageVector? = null @Composable private fun Preview() { Box(modifier = Modifier.padding(12.dp)) { - Image(imageVector = AppIcons.ItalianFlag, contentDescription = "") + Image( + imageVector = AppIcons.ItalianFlag, + contentDescription = "", + modifier = Modifier.size(AppIcons.previewSize) + ) } } From b94287b825190bc051c10b74bbdb61df73bf9f1d Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Tue, 27 Aug 2024 11:23:27 +0200 Subject: [PATCH 8/8] Replace kotlin class for flags with xml --- .../ui/icons/illu/EnglishFlag.kt | 213 ------------------ .../swisstransfer/ui/icons/illu/FrenchFlag.kt | 109 --------- .../swisstransfer/ui/icons/illu/GermanFlag.kt | 91 -------- .../ui/icons/illu/ItalianFlag.kt | 94 -------- .../settings/SettingsEmailLanguageScreen.kt | 13 +- .../ui/screen/main/settings/SettingsScreen.kt | 6 - app/src/main/res/drawable/flag_fr.xml | 22 ++ app/src/main/res/drawable/flag_gb.xml | 49 ++++ app/src/main/res/drawable/flag_ge.xml | 19 ++ app/src/main/res/drawable/flag_it.xml | 19 ++ 10 files changed, 113 insertions(+), 522 deletions(-) delete mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt delete mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt delete mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt delete mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt create mode 100644 app/src/main/res/drawable/flag_fr.xml create mode 100644 app/src/main/res/drawable/flag_gb.xml create mode 100644 app/src/main/res/drawable/flag_ge.xml create mode 100644 app/src/main/res/drawable/flag_it.xml diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt deleted file mode 100644 index 28b4adea0..000000000 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnglishFlag.kt +++ /dev/null @@ -1,213 +0,0 @@ -package com.infomaniak.swisstransfer.ui.icons.illu - -import androidx.compose.foundation.Image -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.PathFillType.Companion.NonZero -import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.graphics.StrokeCap.Companion.Butt -import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.graphics.vector.ImageVector.Builder -import androidx.compose.ui.graphics.vector.PathData -import androidx.compose.ui.graphics.vector.group -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.icons.AppIcons - -val AppIcons.EnglishFlag: ImageVector - get() { - if (_englishFlag != null) { - return _englishFlag!! - } - _englishFlag = Builder( - name = "EnglishFlag", - defaultWidth = 24.0.dp, - defaultHeight = 24.0.dp, - viewportWidth = 24.0f, - viewportHeight = 24.0f - ).apply { - group(clipPathData = PathData { - moveTo(1.333f, 3.0f) - horizontalLineToRelative(21.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) - verticalLineToRelative(16.65f) - arcToRelative(1.333f, 1.333f, 0.0f, false, true, -1.333f, 1.333f) - horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.334f) - verticalLineTo(4.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) - close() - }) { - path( - fill = SolidColor(Color(0xFF0B5394)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(1.333f, 3.0f) - horizontalLineToRelative(21.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) - verticalLineToRelative(16.65f) - arcToRelative(1.333f, 1.333f, 0.0f, false, true, -1.333f, 1.333f) - horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.334f) - verticalLineTo(4.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) - close() - } - path( - fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(12.0f, 11.667f) - lineTo(24.0f, 3.0f) - verticalLineToRelative(3.333f) - lineToRelative(-6.667f, 4.0f) - close() - } - path( - fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(14.667f, 10.334f) - lineTo(24.0f, 3.667f) - verticalLineTo(5.0f) - lineToRelative(-8.0f, 5.334f) - close() - } - path( - fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(12.0f, 13.667f) - lineTo(0.0f, 22.334f) - verticalLineToRelative(-3.333f) - lineToRelative(6.667f, -4.0f) - close() - } - path( - fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(9.333f, 15.0f) - lineTo(0.0f, 21.667f) - verticalLineToRelative(-1.333f) - lineTo(8.0f, 15.0f) - close() - } - path( - fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(12.0f, 11.667f) - lineTo(0.0f, 3.0f) - verticalLineToRelative(3.333f) - lineToRelative(6.667f, 4.0f) - close() - } - path( - fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(9.333f, 10.334f) - lineTo(0.0f, 3.667f) - verticalLineTo(5.0f) - lineToRelative(8.0f, 5.334f) - close() - } - path( - fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(12.0f, 13.667f) - lineToRelative(12.0f, 8.667f) - verticalLineToRelative(-3.333f) - lineToRelative(-6.667f, -4.0f) - close() - } - path( - fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(14.667f, 15.0f) - lineTo(24.0f, 21.667f) - verticalLineToRelative(-1.333f) - lineTo(16.0f, 15.0f) - close() - } - path( - fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(0.0f, 15.0f) - verticalLineTo(9.667f) - horizontalLineToRelative(24.0f) - verticalLineTo(15.0f) - close() - } - path( - fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(9.333f, 3.0f) - horizontalLineToRelative(5.333f) - verticalLineToRelative(19.3f) - horizontalLineTo(9.333f) - close() - } - path( - fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(10.667f, 3.0f) - horizontalLineToRelative(2.667f) - verticalLineToRelative(19.3f) - horizontalLineToRelative(-2.667f) - close() - } - path( - fill = SolidColor(Color(0xFFD0142C)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(0.0f, 13.667f) - verticalLineTo(11.0f) - horizontalLineToRelative(24.0f) - verticalLineToRelative(2.667f) - close() - } - } - } - .build() - return _englishFlag!! - } - -private var _englishFlag: ImageVector? = null - -@Preview -@Composable -private fun Preview() { - Box(modifier = Modifier.padding(12.dp)) { - Image( - imageVector = AppIcons.EnglishFlag, - contentDescription = "", - modifier = Modifier.size(AppIcons.previewSize) - ) - } -} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt deleted file mode 100644 index e6af17ea4..000000000 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/FrenchFlag.kt +++ /dev/null @@ -1,109 +0,0 @@ -package com.infomaniak.swisstransfer.ui.icons.illu - -import androidx.compose.foundation.Image -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.PathFillType.Companion.NonZero -import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.graphics.StrokeCap.Companion.Butt -import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.graphics.vector.ImageVector.Builder -import androidx.compose.ui.graphics.vector.group -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.icons.AppIcons - -val AppIcons.FrenchFlag: ImageVector - get() { - if (_frenchFlag != null) { - return _frenchFlag!! - } - _frenchFlag = Builder( - name = "FrenchFlag", - defaultWidth = 24.0.dp, - defaultHeight = 24.0.dp, - viewportWidth = 24.0f, - viewportHeight = 24.0f - ).apply { - group { - path( - fill = SolidColor(Color(0xFF0B5394)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(1.333f, 3.0f) - horizontalLineToRelative(21.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) - verticalLineToRelative(15.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 22.667f, 21.0f) - horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.667f) - verticalLineTo(4.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) - close() - } - path( - fill = SolidColor(Color(0xFFE70E0E)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(1.333f, 3.0f) - horizontalLineToRelative(21.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) - verticalLineToRelative(16.001f) - arcToRelative(1.333f, 1.333f, 0.0f, false, true, -1.333f, 1.333f) - horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.334f) - verticalLineTo(4.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) - close() - } - path( - fill = SolidColor(Color(0xFF0B5394)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(0.0f, 4.333f) - curveTo(0.0f, 3.597f, 0.597f, 3.0f, 1.333f, 3.0f) - horizontalLineTo(8.0f) - verticalLineToRelative(18.667f) - horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 20.333f) - close() - } - path( - fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(8.0f, 3.0f) - horizontalLineToRelative(8.0f) - verticalLineToRelative(18.667f) - horizontalLineTo(8.0f) - close() - } - } - } - .build() - return _frenchFlag!! - } - -private var _frenchFlag: ImageVector? = null - -@Preview -@Composable -private fun Preview() { - Box(modifier = Modifier.padding(12.dp)) { - Image( - imageVector = AppIcons.FrenchFlag, - contentDescription = "", - modifier = Modifier.size(AppIcons.previewSize) - ) - } -} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt deleted file mode 100644 index 678fef7ce..000000000 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/GermanFlag.kt +++ /dev/null @@ -1,91 +0,0 @@ -package com.infomaniak.swisstransfer.ui.icons.illu - -import androidx.compose.foundation.Image -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.PathFillType.Companion.NonZero -import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.graphics.StrokeCap.Companion.Butt -import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.graphics.vector.ImageVector.Builder -import androidx.compose.ui.graphics.vector.group -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.icons.AppIcons - -val AppIcons.GermanFlag: ImageVector - get() { - if (_germanFlag != null) { - return _germanFlag!! - } - _germanFlag = Builder( - name = "GermanFlag", - defaultWidth = 24.0.dp, - defaultHeight = 24.0.dp, - viewportWidth = 24.0f, - viewportHeight = 24.0f - ).apply { - group { - path( - fill = SolidColor(Color(0xFFE70E0E)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(1.333f, 3.0f) - horizontalLineToRelative(21.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) - verticalLineToRelative(15.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 22.667f, 21.0f) - horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.667f) - verticalLineTo(4.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) - close() - } - path( - fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(0.0f, 3.0f) - horizontalLineToRelative(24.0f) - verticalLineToRelative(6.0f) - horizontalLineTo(0.0f) - close() - } - path( - fill = SolidColor(Color(0xFFFDDA25)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(0.0f, 15.667f) - horizontalLineToRelative(24.0f) - verticalLineToRelative(6.0f) - horizontalLineTo(0.0f) - close() - } - } - } - .build() - return _germanFlag!! - } - -private var _germanFlag: ImageVector? = null - -@Preview -@Composable -private fun Preview() { - Box(modifier = Modifier.padding(12.dp)) { - Image( - imageVector = AppIcons.GermanFlag, - contentDescription = "", - modifier = Modifier.size(AppIcons.previewSize) - ) - } -} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt deleted file mode 100644 index a137e5de2..000000000 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ItalianFlag.kt +++ /dev/null @@ -1,94 +0,0 @@ -package com.infomaniak.swisstransfer.ui.icons.illu - -import androidx.compose.foundation.Image -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.PathFillType.Companion.NonZero -import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.graphics.StrokeCap.Companion.Butt -import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.graphics.vector.ImageVector.Builder -import androidx.compose.ui.graphics.vector.group -import androidx.compose.ui.graphics.vector.path -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import androidx.core.graphics.translationMatrix -import com.infomaniak.swisstransfer.ui.icons.AppIcons - -val AppIcons.ItalianFlag: ImageVector - get() { - if (_italianFlag != null) { - return _italianFlag!! - } - _italianFlag = Builder( - name = "ItalianFlag", - defaultWidth = 24.0.dp, - defaultHeight = 24.0.dp, - viewportWidth = 24.0f, - viewportHeight = 24.0f - ).apply { - group { - path( - fill = SolidColor(Color(0xFFE70E0E)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(1.333f, 3.0f) - horizontalLineToRelative(21.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 24.0f, 4.333f) - verticalLineToRelative(15.334f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 22.667f, 21.0f) - horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.667f) - verticalLineTo(4.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 1.333f, 3.0f) - close() - } - path( - fill = SolidColor(Color(0xFF128D4E)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(0.0f, 4.333f) - curveTo(0.0f, 3.597f, 0.597f, 3.0f, 1.333f, 3.0f) - horizontalLineTo(8.0f) - verticalLineToRelative(18.0f) - horizontalLineTo(1.333f) - arcTo(1.333f, 1.333f, 0.0f, false, true, 0.0f, 19.6f) - close() - } - path( - fill = SolidColor(Color(0xFFFFFFFF)), stroke = null, strokeLineWidth = - 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = - 4.0f, pathFillType = NonZero - ) { - moveTo(8.0f, 3.0f) - horizontalLineToRelative(8.0f) - verticalLineToRelative(18.0f) - horizontalLineTo(8.0f) - close() - } - } - } - .build() - return _italianFlag!! - } - -private var _italianFlag: ImageVector? = null - -@Preview -@Composable -private fun Preview() { - Box(modifier = Modifier.padding(12.dp)) { - Image( - imageVector = AppIcons.ItalianFlag, - contentDescription = "", - modifier = Modifier.size(AppIcons.previewSize) - ) - } -} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt index daaa1b6ee..ce6d7ffdc 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt @@ -29,11 +29,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import com.infomaniak.swisstransfer.R -import com.infomaniak.swisstransfer.ui.icons.AppIcons -import com.infomaniak.swisstransfer.ui.icons.illu.EnglishFlag -import com.infomaniak.swisstransfer.ui.icons.illu.FrenchFlag -import com.infomaniak.swisstransfer.ui.icons.illu.GermanFlag -import com.infomaniak.swisstransfer.ui.icons.illu.ItalianFlag import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingOption import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingTitle import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SingleSelectOptions @@ -56,10 +51,10 @@ enum class EmailLanguage( override val imageVector: ImageVector? = null, override val imageVectorResId: Int? = null ) : SettingOption { - ENGLISH({ stringResource(R.string.settingsEmailLanguageValueEnglish) }, imageVector = AppIcons.EnglishFlag), - FRENCH({ stringResource(R.string.settingsEmailLanguageValueFrench) }, imageVector = AppIcons.FrenchFlag), - GERMAN({ stringResource(R.string.settingsEmailLanguageValueGerman) }, imageVector = AppIcons.GermanFlag), - ITALIAN({ stringResource(R.string.settingsEmailLanguageValueItalian) }, imageVector = AppIcons.ItalianFlag), + ENGLISH({ stringResource(R.string.settingsEmailLanguageValueEnglish) }, imageVectorResId = R.drawable.flag_gb), + FRENCH({ stringResource(R.string.settingsEmailLanguageValueFrench) }, imageVectorResId = R.drawable.flag_fr), + GERMAN({ stringResource(R.string.settingsEmailLanguageValueGerman) }, imageVectorResId = R.drawable.flag_ge), + ITALIAN({ stringResource(R.string.settingsEmailLanguageValueItalian) }, imageVectorResId = R.drawable.flag_it), SPANISH({ stringResource(R.string.settingsEmailLanguageValueSpanish) }, imageVectorResId = R.drawable.flag_es), } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt index 854e3acc4..0e7ff529c 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt @@ -18,12 +18,6 @@ package com.infomaniak.swisstransfer.ui.screen.main.settings -import android.content.ActivityNotFoundException -import android.content.Context -import android.content.Intent -import android.net.Uri -import android.os.Build -import android.provider.Settings import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize diff --git a/app/src/main/res/drawable/flag_fr.xml b/app/src/main/res/drawable/flag_fr.xml new file mode 100644 index 000000000..7a2ab8813 --- /dev/null +++ b/app/src/main/res/drawable/flag_fr.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/flag_gb.xml b/app/src/main/res/drawable/flag_gb.xml new file mode 100644 index 000000000..af86fadce --- /dev/null +++ b/app/src/main/res/drawable/flag_gb.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/flag_ge.xml b/app/src/main/res/drawable/flag_ge.xml new file mode 100644 index 000000000..a5a3b7e78 --- /dev/null +++ b/app/src/main/res/drawable/flag_ge.xml @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/flag_it.xml b/app/src/main/res/drawable/flag_it.xml new file mode 100644 index 000000000..105424d2d --- /dev/null +++ b/app/src/main/res/drawable/flag_it.xml @@ -0,0 +1,19 @@ + + + + + + + +