From 8386cda1d069924503ad9efcdaf8b9df73bd2a31 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Mon, 16 Oct 2023 13:41:56 +0600 Subject: [PATCH 01/18] Add /e/os color palette for new themeing module --- core/ui/compose/theme/build.gradle.kts | 1 + .../k9mail/core/ui/compose/theme/K9Theme.kt | 6 +++-- .../core/ui/compose/theme/ThunderbirdTheme.kt | 6 +++-- .../core/ui/compose/theme/color/Colors.kt | 25 +++++++++++++++++++ .../res/drawable/core_ui_theme_k9_logo.xml | 3 +++ .../core_ui_theme_thunderbird_logo.xml | 3 +++ .../account/common/ui/AppTitleTopHeader.kt | 6 +++++ .../onboarding/ui/OnboardingContent.kt | 4 +++ 8 files changed, 50 insertions(+), 4 deletions(-) diff --git a/core/ui/compose/theme/build.gradle.kts b/core/ui/compose/theme/build.gradle.kts index 30b8ecc1ae..44fa033080 100644 --- a/core/ui/compose/theme/build.gradle.kts +++ b/core/ui/compose/theme/build.gradle.kts @@ -12,4 +12,5 @@ dependencies { implementation(libs.accompanist.systemuicontroller) implementation(libs.androidx.compose.material) implementation(libs.androidx.compose.material.icons.extended) + implementation(libs.elib) } diff --git a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/K9Theme.kt b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/K9Theme.kt index c146811516..c5a71203b4 100644 --- a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/K9Theme.kt +++ b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/K9Theme.kt @@ -2,8 +2,10 @@ package app.k9mail.core.ui.compose.theme import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext import app.k9mail.core.ui.compose.theme.color.MaterialColor import app.k9mail.core.ui.compose.theme.color.darkColors +import app.k9mail.core.ui.compose.theme.color.eOsColors import app.k9mail.core.ui.compose.theme.color.lightColors private val k9LightColorPalette = lightColors( @@ -29,8 +31,8 @@ fun K9Theme( val images = Images(logo = R.drawable.core_ui_theme_k9_logo) MainTheme( - lightColorPalette = k9LightColorPalette, - darkColorPalette = k9DarkColorPalette, + lightColorPalette = eOsColors(LocalContext.current, true), + darkColorPalette = eOsColors(LocalContext.current, false), lightImages = images, darkImages = images, darkTheme = darkTheme, diff --git a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/ThunderbirdTheme.kt b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/ThunderbirdTheme.kt index 48a33971d6..d9d7973539 100644 --- a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/ThunderbirdTheme.kt +++ b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/ThunderbirdTheme.kt @@ -2,8 +2,10 @@ package app.k9mail.core.ui.compose.theme import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext import app.k9mail.core.ui.compose.theme.color.MaterialColor import app.k9mail.core.ui.compose.theme.color.darkColors +import app.k9mail.core.ui.compose.theme.color.eOsColors import app.k9mail.core.ui.compose.theme.color.lightColors private val thunderbirdLightColorPalette = lightColors( @@ -28,8 +30,8 @@ fun ThunderbirdTheme( val images = Images(logo = R.drawable.core_ui_theme_thunderbird_logo) MainTheme( - lightColorPalette = thunderbirdLightColorPalette, - darkColorPalette = thunderbirdDarkColorPalette, + lightColorPalette = eOsColors(LocalContext.current, true), + darkColorPalette = eOsColors(LocalContext.current, false), lightImages = images, darkImages = images, darkTheme = darkTheme, diff --git a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt index 12e1fff377..7d56f9a337 100644 --- a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt +++ b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt @@ -1,8 +1,11 @@ package app.k9mail.core.ui.compose.theme.color +import android.content.Context import androidx.compose.runtime.Immutable import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color +import androidx.core.content.ContextCompat +import foundation.e.elib.R import androidx.compose.material.Colors as MaterialColors @Immutable @@ -102,6 +105,28 @@ internal fun darkColors( isLight = false, ) +internal fun eOsColors(context: Context, isLight: Boolean): Colors { + return Colors( + primary = Color(ContextCompat.getColor(context, R.color.e_accent)), + primaryVariant = Color(ContextCompat.getColor(context, R.color.e_accent)), + secondary = Color(ContextCompat.getColor(context, R.color.e_accent)), + secondaryVariant = Color(ContextCompat.getColor(context, R.color.e_accent)), + background = Color(ContextCompat.getColor(context, R.color.e_background)), + surface = Color(ContextCompat.getColor(context, R.color.e_floating_background)), + success = Color(ContextCompat.getColor(context, R.color.e_accent_green)), + error = Color(ContextCompat.getColor(context, R.color.e_error)), + warning = if (isLight) MaterialColor.orange_600 else MaterialColor.orange_300, + info = if (isLight) MaterialColor.yellow_600 else MaterialColor.yellow_300, + onPrimary = Color(ContextCompat.getColor(context, R.color.e_background)), + onSecondary = Color(ContextCompat.getColor(context, R.color.e_background)), + onBackground = Color(ContextCompat.getColor(context, R.color.e_primary_text_color)), + onSurface = Color(ContextCompat.getColor(context, R.color.e_primary_text_color)), + onMessage = Color(ContextCompat.getColor(context, R.color.e_background)), + toolbar = Color(ContextCompat.getColor(context, R.color.e_action_bar)), + isLight = isLight, + ) +} + internal fun Colors.toMaterialColors(): MaterialColors { return MaterialColors( primary = primary, diff --git a/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_k9_logo.xml b/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_k9_logo.xml index 9a99f8f051..b95a04662b 100644 --- a/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_k9_logo.xml +++ b/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_k9_logo.xml @@ -20,6 +20,9 @@ android:height="108dp" android:viewportWidth="108" android:viewportHeight="108"> + diff --git a/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_thunderbird_logo.xml b/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_thunderbird_logo.xml index 9a99f8f051..b95a04662b 100644 --- a/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_thunderbird_logo.xml +++ b/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_thunderbird_logo.xml @@ -20,6 +20,9 @@ android:height="108dp" android:viewportWidth="108" android:viewportHeight="108"> + diff --git a/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/AppTitleTopHeader.kt b/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/AppTitleTopHeader.kt index ad0818602d..990af4cb94 100644 --- a/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/AppTitleTopHeader.kt +++ b/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/AppTitleTopHeader.kt @@ -5,9 +5,11 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle @@ -15,6 +17,7 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline2 import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer import app.k9mail.core.ui.compose.theme.MainTheme @@ -49,6 +52,9 @@ fun AppTitleTopHeader( Image( painter = painterResource(id = MainTheme.images.logo), contentDescription = null, + modifier = Modifier + .padding(16.dp) + .clip(RoundedCornerShape(16.dp)) ) TextHeadline2( diff --git a/feature/onboarding/src/main/kotlin/app/k9mail/feature/onboarding/ui/OnboardingContent.kt b/feature/onboarding/src/main/kotlin/app/k9mail/feature/onboarding/ui/OnboardingContent.kt index d9142a1f38..bb07ef7f31 100644 --- a/feature/onboarding/src/main/kotlin/app/k9mail/feature/onboarding/ui/OnboardingContent.kt +++ b/feature/onboarding/src/main/kotlin/app/k9mail/feature/onboarding/ui/OnboardingContent.kt @@ -6,12 +6,15 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.composed +import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.common.DevicePreviews import app.k9mail.core.ui.compose.designsystem.atom.Background import app.k9mail.core.ui.compose.designsystem.atom.button.Button @@ -81,6 +84,7 @@ private fun WelcomeLogo( Image( painter = painterResource(id = R.drawable.onboarding_welcome_logo), contentDescription = null, + modifier = Modifier.clip(RoundedCornerShape(16.dp)) ) } } -- GitLab From 8cc247bb55e13bedd3766257c71b7ec4d00fd037 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Mon, 16 Oct 2023 13:42:41 +0600 Subject: [PATCH 02/18] fix auto-config not working for e.email account issue --- .../k9mail/autodiscovery/service/RealAutoDiscoveryService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/autodiscovery/service/src/main/kotlin/app/k9mail/autodiscovery/service/RealAutoDiscoveryService.kt b/feature/autodiscovery/service/src/main/kotlin/app/k9mail/autodiscovery/service/RealAutoDiscoveryService.kt index 2e05ebeba6..cbd51953c1 100644 --- a/feature/autodiscovery/service/src/main/kotlin/app/k9mail/autodiscovery/service/RealAutoDiscoveryService.kt +++ b/feature/autodiscovery/service/src/main/kotlin/app/k9mail/autodiscovery/service/RealAutoDiscoveryService.kt @@ -19,7 +19,7 @@ class RealAutoDiscoveryService( override suspend fun discover(email: EmailAddress): AutoDiscoveryResult { val config = AutoconfigUrlConfig( httpsOnly = false, - includeEmailAddress = false, + includeEmailAddress = true, ) val providerDiscovery = createProviderAutoconfigDiscovery(okHttpClient, config) -- GitLab From 536f7f246ee461598a3db5d549f407d60abe3f45 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Tue, 17 Oct 2023 19:21:17 +0600 Subject: [PATCH 03/18] fix murena openId account auth flow --- .../java/com/fsck/k9/OsAccountManagerUtil.kt | 2 +- .../com/fsck/k9/setup/EeloAccountHelper.kt | 1 + .../fsck/k9/account/AccountSyncReceiver.kt | 2 +- .../java/com/fsck/k9/activity/MessageList.kt | 2 +- .../k9/activity/setup/AccountSetupBasics.kt | 17 +----- .../accountmanager/EeloAccountCreator.java | 2 +- .../core/android/common/ContextExtensions.kt | 25 ++++++++ .../AccountManagerConstants.kt | 22 ++++--- .../accountmanager/AccountManagerHelper.kt | 61 +++++++++++++++++++ feature/account/oauth/build.gradle.kts | 1 + .../account/oauth/AccountOAuthModule.kt | 6 +- .../domain/AccountOAuthDomainContract.kt | 2 +- .../CheckIsAccountManagerOpenIdSignIn.kt | 10 +++ .../domain/usecase/CheckIsGoogleSignIn.kt | 23 ------- .../account/oauth/ui/AccountOAuthContent.kt | 2 +- .../account/oauth/ui/AccountOAuthContract.kt | 7 ++- .../account/oauth/ui/AccountOAuthView.kt | 6 ++ .../account/oauth/ui/AccountOAuthViewModel.kt | 15 ++++- .../account/oauth/ui/view/SignInView.kt | 21 +++---- ... CheckIsAccountManagerOpenIdSignInTest.kt} | 4 +- .../account/oauth/ui/AccountOAuthStateTest.kt | 2 +- .../oauth/ui/AccountOAuthViewModelTest.kt | 10 +-- 22 files changed, 163 insertions(+), 80 deletions(-) create mode 100644 core/android/common/src/main/kotlin/app/k9mail/core/android/common/ContextExtensions.kt rename {app/core/src/main/java/com/fsck/k9/setup => core/android/common/src/main/kotlin/app/k9mail/core/android/common/accountmanager}/AccountManagerConstants.kt (79%) create mode 100644 core/android/common/src/main/kotlin/app/k9mail/core/android/common/accountmanager/AccountManagerHelper.kt create mode 100644 feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsAccountManagerOpenIdSignIn.kt delete mode 100644 feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsGoogleSignIn.kt rename feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/domain/usecase/{CheckIsGoogleSignInTest.kt => CheckIsAccountManagerOpenIdSignInTest.kt} (88%) diff --git a/app/core/src/main/java/com/fsck/k9/OsAccountManagerUtil.kt b/app/core/src/main/java/com/fsck/k9/OsAccountManagerUtil.kt index 3c2330118e..b1401bde17 100644 --- a/app/core/src/main/java/com/fsck/k9/OsAccountManagerUtil.kt +++ b/app/core/src/main/java/com/fsck/k9/OsAccountManagerUtil.kt @@ -20,7 +20,7 @@ import android.accounts.Account import android.accounts.AccountManager import android.content.ContentResolver import android.content.Context -import com.fsck.k9.setup.AccountManagerConstants +import app.k9mail.core.android.common.accountmanager.AccountManagerConstants import timber.log.Timber object OsAccountManagerUtil { diff --git a/app/core/src/main/java/com/fsck/k9/setup/EeloAccountHelper.kt b/app/core/src/main/java/com/fsck/k9/setup/EeloAccountHelper.kt index 2ff0157fdc..fe27b5d24c 100644 --- a/app/core/src/main/java/com/fsck/k9/setup/EeloAccountHelper.kt +++ b/app/core/src/main/java/com/fsck/k9/setup/EeloAccountHelper.kt @@ -17,6 +17,7 @@ package com.fsck.k9.setup import android.content.Context +import app.k9mail.core.android.common.accountmanager.AccountManagerConstants import com.fsck.k9.Account import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.oauth.AuthStateStorage diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountSyncReceiver.kt b/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountSyncReceiver.kt index f34820adb7..9b1d30494a 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountSyncReceiver.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/account/AccountSyncReceiver.kt @@ -22,12 +22,12 @@ import android.content.Context import android.content.Intent import android.os.Build import androidx.annotation.RequiresApi +import app.k9mail.core.android.common.accountmanager.AccountManagerConstants import com.fsck.k9.Account import com.fsck.k9.Preferences import com.fsck.k9.activity.setup.accountmanager.EeloAccountCreator import com.fsck.k9.controller.push.PushController import com.fsck.k9.job.K9JobManager -import com.fsck.k9.setup.AccountManagerConstants import java.util.concurrent.Executors import org.koin.core.component.KoinComponent import org.koin.core.component.inject diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 88b85115e0..c5fc82bad9 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -48,6 +48,7 @@ import androidx.fragment.app.commitNow import androidx.lifecycle.lifecycleScope import app.k9mail.core.android.common.contact.CachingRepository import app.k9mail.core.android.common.contact.ContactRepository +import app.k9mail.core.android.common.accountmanager.AccountManagerConstants import app.k9mail.feature.launcher.FeatureLauncherActivity import com.fsck.k9.Account import com.fsck.k9.K9 @@ -69,7 +70,6 @@ import com.fsck.k9.search.SearchSpecification import com.fsck.k9.search.SearchSpecification.SearchCondition import com.fsck.k9.search.SearchSpecification.SearchField import com.fsck.k9.search.isUnifiedInbox -import com.fsck.k9.setup.AccountManagerConstants import com.fsck.k9.ui.BuildConfig import com.fsck.k9.ui.K9Drawer import com.fsck.k9.ui.R diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.kt index b56f3c3a2d..28cbfeebf4 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/AccountSetupBasics.kt @@ -1,6 +1,5 @@ package com.fsck.k9.activity.setup -import android.accounts.AccountManager import android.app.Activity import android.content.Context import android.content.Intent @@ -14,12 +13,12 @@ import androidx.core.view.isVisible import androidx.lifecycle.lifecycleScope import app.k9mail.autodiscovery.api.DiscoveredServerSettings import app.k9mail.autodiscovery.providersxml.ProvidersXmlDiscovery +import app.k9mail.core.android.common.accountmanager.AccountManagerHelper import com.fsck.k9.Account import com.fsck.k9.Core import com.fsck.k9.EmailAddressValidator import com.fsck.k9.Preferences import com.fsck.k9.account.AccountCreatorHelper -import com.fsck.k9.activity.MessageList import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection import com.fsck.k9.activity.setup.accountmanager.MailAutoConfigDiscovery import com.fsck.k9.helper.SimpleTextWatcher @@ -27,7 +26,6 @@ import com.fsck.k9.helper.Utility.requiredFieldValid import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.ServerSettings import com.fsck.k9.mailstore.SpecialLocalFoldersCreator -import com.fsck.k9.setup.AccountManagerConstants import com.fsck.k9.ui.ConnectionSettings import com.fsck.k9.ui.R import com.fsck.k9.ui.base.K9Activity @@ -220,21 +218,12 @@ class AccountSetupBasics : K9Activity() { } private fun handleOpenIdAuthFlow(hostname: String): Boolean { - val accountType = AccountManagerConstants.getOpenIdAccountTypeByHostName(hostname) ?: return false + val accountType = AccountManagerHelper.getOpenIdAccountTypeByHostName(hostname) ?: return false - startOpenIdOAuthFlow(accountType) + AccountManagerHelper.startOpenIdOAuthFlow(this, accountType, emailView.text?.toString()) return true } - private fun startOpenIdOAuthFlow(accountType: String) { - val osAccountManager = AccountManager.get(this) - val options = Bundle() - options.putString(AccountManagerConstants.OPEN_APP_PACKAGE_AFTER_AUTH, packageName) - options.putString(AccountManagerConstants.OPEN_APP_ACTIVITY_AFTER_AUTH, MessageList::class.java.name) - options.putString(AccountManagerConstants.USERNAME_HINT, emailView.text?.toString()) - osAccountManager.addAccount(accountType, null, null, options, this, null, null) - } - private fun startPasswordFlow() { uiState = UiState.PASSWORD_FLOW diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/EeloAccountCreator.java b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/EeloAccountCreator.java index 185ee1e587..2b001f7a98 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/EeloAccountCreator.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/setup/accountmanager/EeloAccountCreator.java @@ -31,6 +31,7 @@ import androidx.annotation.WorkerThread; import app.k9mail.autodiscovery.api.DiscoveredServerSettings; import app.k9mail.autodiscovery.api.DiscoveryResults; import app.k9mail.autodiscovery.providersxml.ProvidersXmlDiscovery; +import app.k9mail.core.android.common.accountmanager.AccountManagerConstants; import app.k9mail.core.common.mail.Protocols; import com.fsck.k9.Account; import com.fsck.k9.Account.DeletePolicy; @@ -44,7 +45,6 @@ import com.fsck.k9.mail.AuthType; import com.fsck.k9.mail.ConnectionSecurity; import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mailstore.SpecialLocalFoldersCreator; -import com.fsck.k9.setup.AccountManagerConstants; import com.fsck.k9.ui.ConnectionSettings; import timber.log.Timber; diff --git a/core/android/common/src/main/kotlin/app/k9mail/core/android/common/ContextExtensions.kt b/core/android/common/src/main/kotlin/app/k9mail/core/android/common/ContextExtensions.kt new file mode 100644 index 0000000000..606fc55549 --- /dev/null +++ b/core/android/common/src/main/kotlin/app/k9mail/core/android/common/ContextExtensions.kt @@ -0,0 +1,25 @@ +/* + * Copyright MURENA SAS 2023 + * 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 app.k9mail.core.android.common + +import android.app.Activity +import android.content.Context +import android.content.ContextWrapper + +tailrec fun Context.findActivity(): Activity? { + return this as? Activity ?: (this as? ContextWrapper)?.baseContext?.findActivity() +} diff --git a/app/core/src/main/java/com/fsck/k9/setup/AccountManagerConstants.kt b/core/android/common/src/main/kotlin/app/k9mail/core/android/common/accountmanager/AccountManagerConstants.kt similarity index 79% rename from app/core/src/main/java/com/fsck/k9/setup/AccountManagerConstants.kt rename to core/android/common/src/main/kotlin/app/k9mail/core/android/common/accountmanager/AccountManagerConstants.kt index 85ad1d27d4..286deefbd8 100644 --- a/app/core/src/main/java/com/fsck/k9/setup/AccountManagerConstants.kt +++ b/core/android/common/src/main/kotlin/app/k9mail/core/android/common/accountmanager/AccountManagerConstants.kt @@ -1,5 +1,5 @@ /* - * Copyright ECORP SAS 2022 + * Copyright MURENA SAS 2023 * 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 @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -package com.fsck.k9.setup +package app.k9mail.core.android.common.accountmanager object AccountManagerConstants { const val EELO_ACCOUNT_TYPE = "e.foundation.webdav.eelo" @@ -34,11 +34,15 @@ object AccountManagerConstants { val OPENID_ACCOUNT_TYPES = listOf(EELO_ACCOUNT_TYPE, GOOGLE_ACCOUNT_TYPE, YAHOO_ACCOUNT_TYPE) val ALL_ACCOUNT_TYPES = listOf(EELO_ACCOUNT_TYPE, GOOGLE_ACCOUNT_TYPE, YAHOO_ACCOUNT_TYPE) - fun getOpenIdAccountTypeByHostName(hostname: String): String? { - return when(hostname) { - in listOf("imap.gmail.com", "imap.googlemail.com", "smtp.gmail.com", "smtp.googlemail.com") -> GOOGLE_ACCOUNT_TYPE - in listOf("imap.mail.yahoo.com", "smtp.mail.yahoo.com") -> YAHOO_ACCOUNT_TYPE - else -> null - } - } + val GOOGLE_DOMAIN_LIST = listOf( + ".gmail.com", + ".googlemail.com", + ".google.com", + ) + + val YAHOO_DOMAIN_LIST = listOf( + ".yahoo.com", + ) + + const val toOpenAfterAuthActivity = "com.fsck.k9.activity.MessageList" } diff --git a/core/android/common/src/main/kotlin/app/k9mail/core/android/common/accountmanager/AccountManagerHelper.kt b/core/android/common/src/main/kotlin/app/k9mail/core/android/common/accountmanager/AccountManagerHelper.kt new file mode 100644 index 0000000000..7a4421e7d8 --- /dev/null +++ b/core/android/common/src/main/kotlin/app/k9mail/core/android/common/accountmanager/AccountManagerHelper.kt @@ -0,0 +1,61 @@ +/* + * Copyright MURENA SAS 2023 + * 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 app.k9mail.core.android.common.accountmanager + +import android.accounts.AccountManager +import android.content.Context +import android.os.Bundle +import app.k9mail.core.android.common.findActivity + +object AccountManagerHelper { + + fun startOpenIdOAuthFlow(context: Context, accountType: String, email: String?) { + val activity = context.findActivity() ?: return + + val accountManager = AccountManager.get(activity.applicationContext) + + val options = Bundle() + options.putString(AccountManagerConstants.OPEN_APP_PACKAGE_AFTER_AUTH, activity.packageName) + options.putString( + AccountManagerConstants.OPEN_APP_ACTIVITY_AFTER_AUTH, + AccountManagerConstants.toOpenAfterAuthActivity, + ) + options.putString(AccountManagerConstants.USERNAME_HINT, email) + + accountManager.addAccount(accountType, null, null, options, activity, null, null) + } + + fun getOpenIdAccountTypeByHostName(hostname: String): String? { + if (containedInDomain(AccountManagerConstants.GOOGLE_DOMAIN_LIST, hostname)) { + return AccountManagerConstants.GOOGLE_ACCOUNT_TYPE + } else if (containedInDomain(AccountManagerConstants.YAHOO_DOMAIN_LIST, hostname)) { + return AccountManagerConstants.YAHOO_ACCOUNT_TYPE + } + + return null + } + + private fun containedInDomain(domainList: List, hostname: String): Boolean { + for (domain in domainList) { + if (hostname.lowercase().endsWith(domain)) { + return true + } + } + + return false + } +} diff --git a/feature/account/oauth/build.gradle.kts b/feature/account/oauth/build.gradle.kts index 23b5c43aa5..7c4b986d81 100644 --- a/feature/account/oauth/build.gradle.kts +++ b/feature/account/oauth/build.gradle.kts @@ -19,6 +19,7 @@ android { dependencies { implementation(projects.core.ui.compose.designsystem) implementation(projects.core.common) + implementation(projects.core.android.common) implementation(projects.mail.common) diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/AccountOAuthModule.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/AccountOAuthModule.kt index e7df9c80d7..118226a4ff 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/AccountOAuthModule.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/AccountOAuthModule.kt @@ -5,7 +5,7 @@ import app.k9mail.feature.account.oauth.data.AuthorizationRepository import app.k9mail.feature.account.oauth.data.AuthorizationStateRepository import app.k9mail.feature.account.oauth.domain.AccountOAuthDomainContract import app.k9mail.feature.account.oauth.domain.AccountOAuthDomainContract.UseCase -import app.k9mail.feature.account.oauth.domain.usecase.CheckIsGoogleSignIn +import app.k9mail.feature.account.oauth.domain.usecase.CheckIsAccountManagerOpenIdSignIn import app.k9mail.feature.account.oauth.domain.usecase.FinishOAuthSignIn import app.k9mail.feature.account.oauth.domain.usecase.GetOAuthRequestIntent import app.k9mail.feature.account.oauth.domain.usecase.SuggestServerName @@ -46,13 +46,13 @@ val featureAccountOAuthModule: Module = module { factory { FinishOAuthSignIn(repository = get()) } - factory { CheckIsGoogleSignIn() } + factory { CheckIsAccountManagerOpenIdSignIn() } factory { AccountOAuthViewModel( getOAuthRequestIntent = get(), finishOAuthSignIn = get(), - checkIsGoogleSignIn = get(), + checkIsAccountManagerOpenIdSignIn = get(), ) } } diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/AccountOAuthDomainContract.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/AccountOAuthDomainContract.kt index 2a456ccebe..e51b6525e8 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/AccountOAuthDomainContract.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/AccountOAuthDomainContract.kt @@ -23,7 +23,7 @@ interface AccountOAuthDomainContract { suspend fun execute(intent: Intent): AuthorizationResult } - fun interface CheckIsGoogleSignIn { + fun interface CheckIsAccountManagerOpenIdSignIn { fun execute(hostname: String): Boolean } } diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsAccountManagerOpenIdSignIn.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsAccountManagerOpenIdSignIn.kt new file mode 100644 index 0000000000..0acf540f4c --- /dev/null +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsAccountManagerOpenIdSignIn.kt @@ -0,0 +1,10 @@ +package app.k9mail.feature.account.oauth.domain.usecase + +import app.k9mail.core.android.common.accountmanager.AccountManagerHelper +import app.k9mail.feature.account.oauth.domain.AccountOAuthDomainContract.UseCase + +internal class CheckIsAccountManagerOpenIdSignIn : UseCase.CheckIsAccountManagerOpenIdSignIn { + override fun execute(hostname: String): Boolean { + return AccountManagerHelper.getOpenIdAccountTypeByHostName(hostname) != null + } +} diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsGoogleSignIn.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsGoogleSignIn.kt deleted file mode 100644 index 7bc325e27c..0000000000 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsGoogleSignIn.kt +++ /dev/null @@ -1,23 +0,0 @@ -package app.k9mail.feature.account.oauth.domain.usecase - -import app.k9mail.feature.account.oauth.domain.AccountOAuthDomainContract.UseCase - -internal class CheckIsGoogleSignIn : UseCase.CheckIsGoogleSignIn { - override fun execute(hostname: String): Boolean { - for (domain in domainList) { - if (hostname.lowercase().endsWith(domain)) { - return true - } - } - - return false - } - - private companion object { - val domainList = listOf( - ".gmail.com", - ".googlemail.com", - ".google.com", - ) - } -} diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt index 798560d6a0..d51980fb1d 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContent.kt @@ -46,7 +46,7 @@ internal fun AccountOAuthContent( } else { SignInView( onSignInClick = { onEvent(Event.SignInClicked) }, - isGoogleSignIn = state.isGoogleSignIn, + isAccountManagerOpenIdSignIn = state.isAccountManagerOpenIdSignIn, ) } } diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContract.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContract.kt index ca807756b2..bb6dc21838 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContract.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthContract.kt @@ -17,7 +17,7 @@ interface AccountOAuthContract { val wizardNavigationBarState: WizardNavigationBarState = WizardNavigationBarState( isNextEnabled = false, ), - val isGoogleSignIn: Boolean = false, + val isAccountManagerOpenIdSignIn: Boolean = false, val error: Error? = null, val isLoading: Boolean = false, ) @@ -42,6 +42,11 @@ interface AccountOAuthContract { val state: AuthorizationState, ) : Effect object NavigateBack : Effect + + data class LaunchAccountManagerAuth( + val accountType: String, + val emailAddress: String, + ) : Effect } sealed interface Error { diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthView.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthView.kt index 44f458a0d1..fca64f7b3f 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthView.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthView.kt @@ -1,9 +1,12 @@ package app.k9mail.feature.account.oauth.ui +import android.content.Context import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import app.k9mail.core.android.common.accountmanager.AccountManagerHelper import app.k9mail.core.ui.compose.common.mvi.observe import app.k9mail.feature.account.oauth.domain.entity.OAuthResult import app.k9mail.feature.account.oauth.ui.AccountOAuthContract.Effect @@ -22,11 +25,14 @@ fun AccountOAuthView( viewModel.event(Event.OnOAuthResult(it.resultCode, it.data)) } + val context = LocalContext.current + val (state, dispatch) = viewModel.observe { effect -> when (effect) { is Effect.NavigateNext -> onOAuthResult(OAuthResult.Success(effect.state)) is Effect.NavigateBack -> onOAuthResult(OAuthResult.Failure) is Effect.LaunchOAuth -> oAuthLauncher.launch(effect.intent) + is Effect.LaunchAccountManagerAuth -> AccountManagerHelper.startOpenIdOAuthFlow(context, effect.accountType, effect.emailAddress) } } diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthViewModel.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthViewModel.kt index 8ea109d974..82c86af768 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthViewModel.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthViewModel.kt @@ -3,6 +3,7 @@ package app.k9mail.feature.account.oauth.ui import android.app.Activity import android.content.Intent import androidx.lifecycle.viewModelScope +import app.k9mail.core.android.common.accountmanager.AccountManagerHelper import app.k9mail.core.ui.compose.common.mvi.BaseViewModel import app.k9mail.feature.account.common.domain.entity.AuthorizationState import app.k9mail.feature.account.oauth.domain.AccountOAuthDomainContract.UseCase @@ -19,15 +20,15 @@ class AccountOAuthViewModel( initialState: State = State(), private val getOAuthRequestIntent: UseCase.GetOAuthRequestIntent, private val finishOAuthSignIn: UseCase.FinishOAuthSignIn, - private val checkIsGoogleSignIn: UseCase.CheckIsGoogleSignIn, + private val checkIsAccountManagerOpenIdSignIn: UseCase.CheckIsAccountManagerOpenIdSignIn, ) : BaseViewModel(initialState), ViewModel { override fun initState(state: State) { - val isGoogleSignIn = checkIsGoogleSignIn.execute(state.hostname) + val isAccountManagerOpenIdSignIn = checkIsAccountManagerOpenIdSignIn.execute(state.hostname) updateState { state.copy( - isGoogleSignIn = isGoogleSignIn, + isAccountManagerOpenIdSignIn = isAccountManagerOpenIdSignIn, ) } } @@ -45,6 +46,14 @@ class AccountOAuthViewModel( } private fun onSignIn() { + if (state.value.isAccountManagerOpenIdSignIn) { + val accountType = AccountManagerHelper.getOpenIdAccountTypeByHostName(state.value.hostname) + if (accountType != null) { + emitEffect(Effect.LaunchAccountManagerAuth(accountType, state.value.emailAddress)) + return + } + } + val result = getOAuthRequestIntent.execute( hostname = state.value.hostname, emailAddress = state.value.emailAddress, diff --git a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt index 7a711c7e32..96b4042e15 100644 --- a/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt +++ b/feature/account/oauth/src/main/kotlin/app/k9mail/feature/account/oauth/ui/view/SignInView.kt @@ -16,7 +16,7 @@ import app.k9mail.feature.account.oauth.R @Composable internal fun SignInView( onSignInClick: () -> Unit, - isGoogleSignIn: Boolean, + isAccountManagerOpenIdSignIn: Boolean, modifier: Modifier = Modifier, ) { Column( @@ -29,16 +29,11 @@ internal fun SignInView( textAlign = TextAlign.Center, ) - if (isGoogleSignIn) { - SignInWithGoogleButton( - onClick = onSignInClick, - ) - } else { - Button( - text = stringResource(id = R.string.account_oauth_sign_in_button), - onClick = onSignInClick, - ) - } + + Button( + text = stringResource(id = R.string.account_oauth_sign_in_button), + onClick = onSignInClick, + ) } } @@ -47,7 +42,7 @@ internal fun SignInView( internal fun SignInViewPreview() { SignInView( onSignInClick = {}, - isGoogleSignIn = false, + isAccountManagerOpenIdSignIn = false, ) } @@ -56,6 +51,6 @@ internal fun SignInViewPreview() { internal fun SignInViewWithGooglePreview() { SignInView( onSignInClick = {}, - isGoogleSignIn = true, + isAccountManagerOpenIdSignIn = true, ) } diff --git a/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsGoogleSignInTest.kt b/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsAccountManagerOpenIdSignInTest.kt similarity index 88% rename from feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsGoogleSignInTest.kt rename to feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsAccountManagerOpenIdSignInTest.kt index e6605d794a..ecd04516c0 100644 --- a/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsGoogleSignInTest.kt +++ b/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/domain/usecase/CheckIsAccountManagerOpenIdSignInTest.kt @@ -5,9 +5,9 @@ import assertk.assertions.isFalse import assertk.assertions.isTrue import org.junit.Test -class CheckIsGoogleSignInTest { +class CheckIsAccountManagerOpenIdSignInTest { - private val testSubject = CheckIsGoogleSignIn() + private val testSubject = CheckIsAccountManagerOpenIdSignIn() @Test fun `should return true when hostname ends with a google domain`() { diff --git a/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthStateTest.kt b/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthStateTest.kt index c68afbf079..7f9b4361d7 100644 --- a/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthStateTest.kt +++ b/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthStateTest.kt @@ -22,7 +22,7 @@ class AccountOAuthStateTest { isNextEnabled = false, ), ) - prop(State::isGoogleSignIn).isEqualTo(false) + prop(State::isAccountManagerOpenIdSignIn).isEqualTo(false) prop(State::error).isEqualTo(null) prop(State::isLoading).isEqualTo(false) } diff --git a/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthViewModelTest.kt b/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthViewModelTest.kt index a7769480b0..f6823aa15e 100644 --- a/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthViewModelTest.kt +++ b/feature/account/oauth/src/test/kotlin/app/k9mail/feature/account/oauth/ui/AccountOAuthViewModelTest.kt @@ -28,7 +28,7 @@ class AccountOAuthViewModelTest { val mainDispatcherRule = MainDispatcherRule() @Test - fun `should change state when google hostname found on initState`() = runTest { + fun `should change state when accountManager supported openId hostname found on initState`() = runTest { val testSubject = createTestSubject( isGoogleSignIn = true, ) @@ -50,12 +50,12 @@ class AccountOAuthViewModelTest { actual = stateTurbine.awaitItem(), turbines = turbines, ) { - isEqualTo(defaultState.copy(isGoogleSignIn = true)) + isEqualTo(defaultState.copy(isAccountManagerOpenIdSignIn = true)) } } @Test - fun `should not change state when no google hostname found on initState`() = runTest { + fun `should not change state when no accountManager openId supported hostname found on initState`() = runTest { val testSubject = createTestSubject( isGoogleSignIn = false, ) @@ -77,7 +77,7 @@ class AccountOAuthViewModelTest { actual = stateTurbine.awaitItem(), turbines = turbines, ) { - isEqualTo(defaultState.copy(isGoogleSignIn = false)) + isEqualTo(defaultState.copy(isAccountManagerOpenIdSignIn = false)) } } @@ -374,7 +374,7 @@ class AccountOAuthViewModelTest { delay(50) authorizationResult }, - checkIsGoogleSignIn = { _ -> + checkIsAccountManagerOpenIdSignIn = { _ -> isGoogleSignIn }, initialState = initialState, -- GitLab From e56aab6f7b1ad63a8ad8556b3c23cbdb1dab4b0d Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Wed, 18 Oct 2023 13:20:18 +0600 Subject: [PATCH 04/18] fix base icon color issue of jetpack compose flow --- .../k9mail/core/ui/compose/designsystem/atom/Checkbox.kt | 6 ++++++ .../app/k9mail/core/ui/compose/designsystem/atom/Icon.kt | 5 ++--- .../app/k9mail/core/ui/compose/designsystem/atom/Switch.kt | 5 +++++ .../java/app/k9mail/core/ui/compose/theme/color/Colors.kt | 4 ++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Checkbox.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Checkbox.kt index b3e8ed3b46..74b51f80ef 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Checkbox.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Checkbox.kt @@ -1,8 +1,10 @@ package app.k9mail.core.ui.compose.designsystem.atom +import androidx.compose.material.CheckboxDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.core.ui.compose.theme.PreviewWithThemes import androidx.compose.material.Checkbox as MaterialCheckbox @@ -18,6 +20,10 @@ fun Checkbox( onCheckedChange = onCheckedChange, modifier = modifier, enabled = enabled, + colors = CheckboxDefaults.colors( + checkedColor = MainTheme.colors.primary, + checkmarkColor = MainTheme.colors.onPrimary, + ), ) } diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Icon.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Icon.kt index df0bb7feba..bf81d05bef 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Icon.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Icon.kt @@ -1,13 +1,12 @@ package app.k9mail.core.ui.compose.designsystem.atom -import androidx.compose.material.LocalContentAlpha -import androidx.compose.material.LocalContentColor import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.tooling.preview.Preview import app.k9mail.core.ui.compose.theme.Icons +import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.core.ui.compose.theme.PreviewWithThemes import androidx.compose.material.Icon as MaterialIcon @@ -15,7 +14,7 @@ import androidx.compose.material.Icon as MaterialIcon fun Icon( imageVector: ImageVector, modifier: Modifier = Modifier, - tint: Color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current), + tint: Color = MainTheme.colors.secondary, ) { MaterialIcon( imageVector = imageVector, diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Switch.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Switch.kt index 1c449c3bb0..1a421fe515 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Switch.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/Switch.kt @@ -1,8 +1,10 @@ package app.k9mail.core.ui.compose.designsystem.atom +import androidx.compose.material.SwitchDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.core.ui.compose.theme.PreviewWithThemes import androidx.compose.material.Switch as MaterialSwitch @@ -18,6 +20,9 @@ fun Switch( onCheckedChange = onCheckedChange, modifier = modifier, enabled = enabled, + colors = SwitchDefaults.colors( + checkedThumbColor = MainTheme.colors.primary, + ), ) } diff --git a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt index 7d56f9a337..85d20a6d32 100644 --- a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt +++ b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt @@ -109,8 +109,8 @@ internal fun eOsColors(context: Context, isLight: Boolean): Colors { return Colors( primary = Color(ContextCompat.getColor(context, R.color.e_accent)), primaryVariant = Color(ContextCompat.getColor(context, R.color.e_accent)), - secondary = Color(ContextCompat.getColor(context, R.color.e_accent)), - secondaryVariant = Color(ContextCompat.getColor(context, R.color.e_accent)), + secondary = Color(ContextCompat.getColor(context, R.color.e_icon_color)), + secondaryVariant = Color(ContextCompat.getColor(context, R.color.e_icon_color)), background = Color(ContextCompat.getColor(context, R.color.e_background)), surface = Color(ContextCompat.getColor(context, R.color.e_floating_background)), success = Color(ContextCompat.getColor(context, R.color.e_accent_green)), -- GitLab From 32327230b0887c2b8b10ed8e6f3f472bac3c2311 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Wed, 18 Oct 2023 18:07:53 +0600 Subject: [PATCH 05/18] Update compose back button style --- .../k9mail/feature/account/common/ui/WizardNavigationBar.kt | 4 ++-- .../server/certificate/ui/ServerCertificateErrorScreen.kt | 4 ++-- .../ui/autodiscovery/view/AutoDiscoveryResultBodyView.kt | 2 +- feature/onboarding/src/main/res/values-be/strings.xml | 3 +++ feature/onboarding/src/main/res/values-br/strings.xml | 3 +++ feature/onboarding/src/main/res/values-de/strings.xml | 3 +++ feature/onboarding/src/main/res/values-fi/strings.xml | 3 +++ feature/onboarding/src/main/res/values-fr/strings.xml | 3 +++ feature/onboarding/src/main/res/values-fy/strings.xml | 3 +++ feature/onboarding/src/main/res/values-gd/strings.xml | 2 ++ feature/onboarding/src/main/res/values-is/strings.xml | 2 ++ feature/onboarding/src/main/res/values-it/strings.xml | 3 +++ feature/onboarding/src/main/res/values-nl/strings.xml | 3 +++ feature/onboarding/src/main/res/values-ru/strings.xml | 3 +++ feature/onboarding/src/main/res/values-sv/strings.xml | 3 +++ feature/onboarding/src/main/res/values-tr/strings.xml | 3 +++ 16 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 feature/onboarding/src/main/res/values-be/strings.xml create mode 100644 feature/onboarding/src/main/res/values-br/strings.xml create mode 100644 feature/onboarding/src/main/res/values-de/strings.xml create mode 100644 feature/onboarding/src/main/res/values-fi/strings.xml create mode 100644 feature/onboarding/src/main/res/values-fr/strings.xml create mode 100644 feature/onboarding/src/main/res/values-fy/strings.xml create mode 100644 feature/onboarding/src/main/res/values-gd/strings.xml create mode 100644 feature/onboarding/src/main/res/values-is/strings.xml create mode 100644 feature/onboarding/src/main/res/values-it/strings.xml create mode 100644 feature/onboarding/src/main/res/values-nl/strings.xml create mode 100644 feature/onboarding/src/main/res/values-ru/strings.xml create mode 100644 feature/onboarding/src/main/res/values-sv/strings.xml create mode 100644 feature/onboarding/src/main/res/values-tr/strings.xml diff --git a/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/WizardNavigationBar.kt b/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/WizardNavigationBar.kt index 1f50e2884b..6fd09eb12d 100644 --- a/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/WizardNavigationBar.kt +++ b/feature/account/common/src/main/kotlin/app/k9mail/feature/account/common/ui/WizardNavigationBar.kt @@ -9,7 +9,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import app.k9mail.core.ui.compose.common.DevicePreviews import app.k9mail.core.ui.compose.designsystem.atom.button.Button -import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonOutlined +import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer import app.k9mail.core.ui.compose.theme.K9Theme import app.k9mail.core.ui.compose.theme.MainTheme @@ -42,7 +42,7 @@ fun WizardNavigationBar( horizontalArrangement = getHorizontalArrangement(state), ) { if (state.showBack) { - ButtonOutlined( + ButtonText( text = backButtonText, onClick = onBackClick, enabled = state.isBackEnabled, diff --git a/feature/account/server/certificate/src/main/kotlin/app/k9mail/feature/account/server/certificate/ui/ServerCertificateErrorScreen.kt b/feature/account/server/certificate/src/main/kotlin/app/k9mail/feature/account/server/certificate/ui/ServerCertificateErrorScreen.kt index bcf6bc6336..48b32d5f99 100644 --- a/feature/account/server/certificate/src/main/kotlin/app/k9mail/feature/account/server/certificate/ui/ServerCertificateErrorScreen.kt +++ b/feature/account/server/certificate/src/main/kotlin/app/k9mail/feature/account/server/certificate/ui/ServerCertificateErrorScreen.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.Modifier import app.k9mail.core.ui.compose.common.DevicePreviews import app.k9mail.core.ui.compose.common.mvi.observe import app.k9mail.core.ui.compose.designsystem.atom.button.Button -import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonOutlined +import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText import app.k9mail.core.ui.compose.designsystem.atom.text.TextBody1 import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline4 import app.k9mail.core.ui.compose.designsystem.atom.text.TextSubtitle1 @@ -63,7 +63,7 @@ fun ServerCertificateErrorScreen( modifier = Modifier .fillMaxWidth(), ) - ButtonOutlined( + ButtonText( text = "Accept consequences and continue", onClick = { dispatch(Event.OnCertificateAcceptedClicked) }, modifier = Modifier.fillMaxWidth(), diff --git a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/autodiscovery/view/AutoDiscoveryResultBodyView.kt b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/autodiscovery/view/AutoDiscoveryResultBodyView.kt index edc2cc1157..b76bbffeeb 100644 --- a/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/autodiscovery/view/AutoDiscoveryResultBodyView.kt +++ b/feature/account/setup/src/main/kotlin/app/k9mail/feature/account/setup/ui/autodiscovery/view/AutoDiscoveryResultBodyView.kt @@ -96,7 +96,7 @@ internal fun EditConfigurationButton( ButtonText( text = stringResource(id = R.string.account_setup_auto_discovery_result_edit_configuration_button_label), onClick = onEditConfigurationClick, - color = MainTheme.colors.warning, + color = MainTheme.colors.primary, contentPadding = buttonContentPadding( start = MainTheme.spacings.double, end = MainTheme.spacings.double, diff --git a/feature/onboarding/src/main/res/values-be/strings.xml b/feature/onboarding/src/main/res/values-be/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-be/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-br/strings.xml b/feature/onboarding/src/main/res/values-br/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-br/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-de/strings.xml b/feature/onboarding/src/main/res/values-de/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-de/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-fi/strings.xml b/feature/onboarding/src/main/res/values-fi/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-fi/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-fr/strings.xml b/feature/onboarding/src/main/res/values-fr/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-fr/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-fy/strings.xml b/feature/onboarding/src/main/res/values-fy/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-fy/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-gd/strings.xml b/feature/onboarding/src/main/res/values-gd/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/feature/onboarding/src/main/res/values-gd/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/feature/onboarding/src/main/res/values-is/strings.xml b/feature/onboarding/src/main/res/values-is/strings.xml new file mode 100644 index 0000000000..3ea04e700d --- /dev/null +++ b/feature/onboarding/src/main/res/values-is/strings.xml @@ -0,0 +1,2 @@ + + diff --git a/feature/onboarding/src/main/res/values-it/strings.xml b/feature/onboarding/src/main/res/values-it/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-it/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-nl/strings.xml b/feature/onboarding/src/main/res/values-nl/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-nl/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-ru/strings.xml b/feature/onboarding/src/main/res/values-ru/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-ru/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-sv/strings.xml b/feature/onboarding/src/main/res/values-sv/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-sv/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/feature/onboarding/src/main/res/values-tr/strings.xml b/feature/onboarding/src/main/res/values-tr/strings.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/feature/onboarding/src/main/res/values-tr/strings.xml @@ -0,0 +1,3 @@ + + + -- GitLab From 845fef13f8597e783d5119d5d1eafe21ee5898ff Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Wed, 18 Oct 2023 23:03:05 +0600 Subject: [PATCH 06/18] import translations for onboarding feature --- .../app/k9mail/feature/onboarding/ui/OnboardingContent.kt | 6 +++--- feature/onboarding/src/main/res/values-ar/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-be/strings.xml | 3 +++ feature/onboarding/src/main/res/values-bg/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-br/strings.xml | 3 +++ feature/onboarding/src/main/res/values-ca/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-cs/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-cy/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-da/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-de/strings.xml | 4 ++++ feature/onboarding/src/main/res/values-el/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-eo/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-es/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-et/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-eu/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-fa/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-fi/strings.xml | 3 +++ feature/onboarding/src/main/res/values-fr/strings.xml | 4 ++++ feature/onboarding/src/main/res/values-fy/strings.xml | 3 +++ feature/onboarding/src/main/res/values-gd/strings.xml | 6 +++++- feature/onboarding/src/main/res/values-gl-rES/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-gl/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-hr/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-hu/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-in/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-is/strings.xml | 7 ++++++- feature/onboarding/src/main/res/values-it/strings.xml | 4 ++++ feature/onboarding/src/main/res/values-iw/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-ja/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-ko/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-lt/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-lv/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-ml/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-nb/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-nl/strings.xml | 4 ++++ feature/onboarding/src/main/res/values-pl/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-pt-rBR/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-pt-rPT/strings.xml | 6 ++++++ feature/onboarding/src/main/res/values-ro/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-ru/strings.xml | 4 ++++ feature/onboarding/src/main/res/values-sk/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-sl/strings.xml | 6 ++++++ feature/onboarding/src/main/res/values-sq/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-sr/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-sv/strings.xml | 4 ++++ feature/onboarding/src/main/res/values-tr/strings.xml | 3 +++ feature/onboarding/src/main/res/values-uk/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-zh-rCN/strings.xml | 5 +++++ feature/onboarding/src/main/res/values-zh-rTW/strings.xml | 5 +++++ feature/onboarding/src/main/res/values/strings.xml | 6 +++--- 50 files changed, 233 insertions(+), 8 deletions(-) create mode 100644 feature/onboarding/src/main/res/values-ar/strings.xml create mode 100644 feature/onboarding/src/main/res/values-bg/strings.xml create mode 100644 feature/onboarding/src/main/res/values-ca/strings.xml create mode 100644 feature/onboarding/src/main/res/values-cs/strings.xml create mode 100644 feature/onboarding/src/main/res/values-cy/strings.xml create mode 100644 feature/onboarding/src/main/res/values-da/strings.xml create mode 100644 feature/onboarding/src/main/res/values-el/strings.xml create mode 100644 feature/onboarding/src/main/res/values-eo/strings.xml create mode 100644 feature/onboarding/src/main/res/values-es/strings.xml create mode 100644 feature/onboarding/src/main/res/values-et/strings.xml create mode 100644 feature/onboarding/src/main/res/values-eu/strings.xml create mode 100644 feature/onboarding/src/main/res/values-fa/strings.xml create mode 100644 feature/onboarding/src/main/res/values-gl-rES/strings.xml create mode 100644 feature/onboarding/src/main/res/values-gl/strings.xml create mode 100644 feature/onboarding/src/main/res/values-hr/strings.xml create mode 100644 feature/onboarding/src/main/res/values-hu/strings.xml create mode 100644 feature/onboarding/src/main/res/values-in/strings.xml create mode 100644 feature/onboarding/src/main/res/values-iw/strings.xml create mode 100644 feature/onboarding/src/main/res/values-ja/strings.xml create mode 100644 feature/onboarding/src/main/res/values-ko/strings.xml create mode 100644 feature/onboarding/src/main/res/values-lt/strings.xml create mode 100644 feature/onboarding/src/main/res/values-lv/strings.xml create mode 100644 feature/onboarding/src/main/res/values-ml/strings.xml create mode 100644 feature/onboarding/src/main/res/values-nb/strings.xml create mode 100644 feature/onboarding/src/main/res/values-pl/strings.xml create mode 100644 feature/onboarding/src/main/res/values-pt-rBR/strings.xml create mode 100644 feature/onboarding/src/main/res/values-pt-rPT/strings.xml create mode 100644 feature/onboarding/src/main/res/values-ro/strings.xml create mode 100644 feature/onboarding/src/main/res/values-sk/strings.xml create mode 100644 feature/onboarding/src/main/res/values-sl/strings.xml create mode 100644 feature/onboarding/src/main/res/values-sq/strings.xml create mode 100644 feature/onboarding/src/main/res/values-sr/strings.xml create mode 100644 feature/onboarding/src/main/res/values-uk/strings.xml create mode 100644 feature/onboarding/src/main/res/values-zh-rCN/strings.xml create mode 100644 feature/onboarding/src/main/res/values-zh-rTW/strings.xml diff --git a/feature/onboarding/src/main/kotlin/app/k9mail/feature/onboarding/ui/OnboardingContent.kt b/feature/onboarding/src/main/kotlin/app/k9mail/feature/onboarding/ui/OnboardingContent.kt index bb07ef7f31..24c63786a3 100644 --- a/feature/onboarding/src/main/kotlin/app/k9mail/feature/onboarding/ui/OnboardingContent.kt +++ b/feature/onboarding/src/main/kotlin/app/k9mail/feature/onboarding/ui/OnboardingContent.kt @@ -20,7 +20,7 @@ import app.k9mail.core.ui.compose.designsystem.atom.Background import app.k9mail.core.ui.compose.designsystem.atom.button.Button import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText import app.k9mail.core.ui.compose.designsystem.atom.text.TextBody1 -import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline2 +import app.k9mail.core.ui.compose.designsystem.atom.text.TextHeadline4 import app.k9mail.core.ui.compose.designsystem.template.LazyColumnWithHeaderFooter import app.k9mail.core.ui.compose.designsystem.template.ResponsiveContent import app.k9mail.core.ui.compose.theme.K9Theme @@ -84,7 +84,7 @@ private fun WelcomeLogo( Image( painter = painterResource(id = R.drawable.onboarding_welcome_logo), contentDescription = null, - modifier = Modifier.clip(RoundedCornerShape(16.dp)) + modifier = Modifier.clip(RoundedCornerShape(16.dp)), ) } } @@ -97,7 +97,7 @@ private fun WelcomeTitle( modifier = modifier, horizontalAlignment = Alignment.CenterHorizontally, ) { - TextHeadline2( + TextHeadline4( text = stringResource(id = R.string.onboarding_welcome_title), ) } diff --git a/feature/onboarding/src/main/res/values-ar/strings.xml b/feature/onboarding/src/main/res/values-ar/strings.xml new file mode 100644 index 0000000000..399df76345 --- /dev/null +++ b/feature/onboarding/src/main/res/values-ar/strings.xml @@ -0,0 +1,5 @@ + + + التالي + استيراد الإعدادات + diff --git a/feature/onboarding/src/main/res/values-be/strings.xml b/feature/onboarding/src/main/res/values-be/strings.xml index 045e125f3d..f420a734a3 100644 --- a/feature/onboarding/src/main/res/values-be/strings.xml +++ b/feature/onboarding/src/main/res/values-be/strings.xml @@ -1,3 +1,6 @@ + Вітаем у Mail + Далей + Імпартаваць налады diff --git a/feature/onboarding/src/main/res/values-bg/strings.xml b/feature/onboarding/src/main/res/values-bg/strings.xml new file mode 100644 index 0000000000..5d77071c74 --- /dev/null +++ b/feature/onboarding/src/main/res/values-bg/strings.xml @@ -0,0 +1,5 @@ + + + Следващ + Внасяне настройки + diff --git a/feature/onboarding/src/main/res/values-br/strings.xml b/feature/onboarding/src/main/res/values-br/strings.xml index 045e125f3d..ade765d622 100644 --- a/feature/onboarding/src/main/res/values-br/strings.xml +++ b/feature/onboarding/src/main/res/values-br/strings.xml @@ -1,3 +1,6 @@ + Donemat war Mail + Kenderc’hel + Enporzhiañ an arventennoù diff --git a/feature/onboarding/src/main/res/values-ca/strings.xml b/feature/onboarding/src/main/res/values-ca/strings.xml new file mode 100644 index 0000000000..3198597426 --- /dev/null +++ b/feature/onboarding/src/main/res/values-ca/strings.xml @@ -0,0 +1,5 @@ + + + Següent + Importa la configuració + diff --git a/feature/onboarding/src/main/res/values-cs/strings.xml b/feature/onboarding/src/main/res/values-cs/strings.xml new file mode 100644 index 0000000000..fe94fff8fd --- /dev/null +++ b/feature/onboarding/src/main/res/values-cs/strings.xml @@ -0,0 +1,5 @@ + + + Další + Importovat nastavení + diff --git a/feature/onboarding/src/main/res/values-cy/strings.xml b/feature/onboarding/src/main/res/values-cy/strings.xml new file mode 100644 index 0000000000..b5f0d1ad72 --- /dev/null +++ b/feature/onboarding/src/main/res/values-cy/strings.xml @@ -0,0 +1,5 @@ + + + Nesaf + Mewnforio gosodiadau + diff --git a/feature/onboarding/src/main/res/values-da/strings.xml b/feature/onboarding/src/main/res/values-da/strings.xml new file mode 100644 index 0000000000..ef76d7eaa0 --- /dev/null +++ b/feature/onboarding/src/main/res/values-da/strings.xml @@ -0,0 +1,5 @@ + + + Næste + Importér opsætning + diff --git a/feature/onboarding/src/main/res/values-de/strings.xml b/feature/onboarding/src/main/res/values-de/strings.xml index 045e125f3d..215f0e3ab5 100644 --- a/feature/onboarding/src/main/res/values-de/strings.xml +++ b/feature/onboarding/src/main/res/values-de/strings.xml @@ -1,3 +1,7 @@ + Willkommen bei Mail + Erstelle ein neues Konto oder importiere deine E-Mail-Konten aus einer vorherigen Einstellungsdatei. + Weiter + Einstellungen importieren diff --git a/feature/onboarding/src/main/res/values-el/strings.xml b/feature/onboarding/src/main/res/values-el/strings.xml new file mode 100644 index 0000000000..01644fd162 --- /dev/null +++ b/feature/onboarding/src/main/res/values-el/strings.xml @@ -0,0 +1,5 @@ + + + Επόμενο + Εισαγωγή ρυθμίσεων + diff --git a/feature/onboarding/src/main/res/values-eo/strings.xml b/feature/onboarding/src/main/res/values-eo/strings.xml new file mode 100644 index 0000000000..c8ed5b2b57 --- /dev/null +++ b/feature/onboarding/src/main/res/values-eo/strings.xml @@ -0,0 +1,5 @@ + + + Sekva + Enporti agordojn + diff --git a/feature/onboarding/src/main/res/values-es/strings.xml b/feature/onboarding/src/main/res/values-es/strings.xml new file mode 100644 index 0000000000..a0ca16fcc1 --- /dev/null +++ b/feature/onboarding/src/main/res/values-es/strings.xml @@ -0,0 +1,5 @@ + + + Siguiente + Importar ajustes + diff --git a/feature/onboarding/src/main/res/values-et/strings.xml b/feature/onboarding/src/main/res/values-et/strings.xml new file mode 100644 index 0000000000..da6cd7d5b7 --- /dev/null +++ b/feature/onboarding/src/main/res/values-et/strings.xml @@ -0,0 +1,5 @@ + + + Järgmine + Impordi sätted + diff --git a/feature/onboarding/src/main/res/values-eu/strings.xml b/feature/onboarding/src/main/res/values-eu/strings.xml new file mode 100644 index 0000000000..7282c1778a --- /dev/null +++ b/feature/onboarding/src/main/res/values-eu/strings.xml @@ -0,0 +1,5 @@ + + + Hurrengoa + Inportatu ezarpenak + diff --git a/feature/onboarding/src/main/res/values-fa/strings.xml b/feature/onboarding/src/main/res/values-fa/strings.xml new file mode 100644 index 0000000000..43bd5da9a0 --- /dev/null +++ b/feature/onboarding/src/main/res/values-fa/strings.xml @@ -0,0 +1,5 @@ + + + بعدی + درون‌برد تنظیمات + diff --git a/feature/onboarding/src/main/res/values-fi/strings.xml b/feature/onboarding/src/main/res/values-fi/strings.xml index 045e125f3d..b1c6629a3c 100644 --- a/feature/onboarding/src/main/res/values-fi/strings.xml +++ b/feature/onboarding/src/main/res/values-fi/strings.xml @@ -1,3 +1,6 @@ + Tervetuloa Mail Mailiin + Seuraava + Tuo asetukset diff --git a/feature/onboarding/src/main/res/values-fr/strings.xml b/feature/onboarding/src/main/res/values-fr/strings.xml index 045e125f3d..d3b711f439 100644 --- a/feature/onboarding/src/main/res/values-fr/strings.xml +++ b/feature/onboarding/src/main/res/values-fr/strings.xml @@ -1,3 +1,7 @@ + Bienvenue sur Mail + Paramétrez un nouveau compte ou importez des comptes e-mail depuis un fichier de paramétrages. + Suivant + Importer les paramètres diff --git a/feature/onboarding/src/main/res/values-fy/strings.xml b/feature/onboarding/src/main/res/values-fy/strings.xml index 045e125f3d..04cf23369c 100644 --- a/feature/onboarding/src/main/res/values-fy/strings.xml +++ b/feature/onboarding/src/main/res/values-fy/strings.xml @@ -1,3 +1,6 @@ + Wolkom by Mail + Folgjende + Ymportynstellingen diff --git a/feature/onboarding/src/main/res/values-gd/strings.xml b/feature/onboarding/src/main/res/values-gd/strings.xml index 3ea04e700d..e115e5b53e 100644 --- a/feature/onboarding/src/main/res/values-gd/strings.xml +++ b/feature/onboarding/src/main/res/values-gd/strings.xml @@ -1,2 +1,6 @@ - + + Fàilte gu aplacaid a’ phuist + Air adhart + Ion-phortaich na roghainnean + diff --git a/feature/onboarding/src/main/res/values-gl-rES/strings.xml b/feature/onboarding/src/main/res/values-gl-rES/strings.xml new file mode 100644 index 0000000000..3955e81387 --- /dev/null +++ b/feature/onboarding/src/main/res/values-gl-rES/strings.xml @@ -0,0 +1,5 @@ + + + Seguinte + Importar axustes + diff --git a/feature/onboarding/src/main/res/values-gl/strings.xml b/feature/onboarding/src/main/res/values-gl/strings.xml new file mode 100644 index 0000000000..3955e81387 --- /dev/null +++ b/feature/onboarding/src/main/res/values-gl/strings.xml @@ -0,0 +1,5 @@ + + + Seguinte + Importar axustes + diff --git a/feature/onboarding/src/main/res/values-hr/strings.xml b/feature/onboarding/src/main/res/values-hr/strings.xml new file mode 100644 index 0000000000..161e08ac5b --- /dev/null +++ b/feature/onboarding/src/main/res/values-hr/strings.xml @@ -0,0 +1,5 @@ + + + Slijedeća + Uvoz postavki + diff --git a/feature/onboarding/src/main/res/values-hu/strings.xml b/feature/onboarding/src/main/res/values-hu/strings.xml new file mode 100644 index 0000000000..38a7e92775 --- /dev/null +++ b/feature/onboarding/src/main/res/values-hu/strings.xml @@ -0,0 +1,5 @@ + + + Következő + Beállítások importálása + diff --git a/feature/onboarding/src/main/res/values-in/strings.xml b/feature/onboarding/src/main/res/values-in/strings.xml new file mode 100644 index 0000000000..4fc05c59e2 --- /dev/null +++ b/feature/onboarding/src/main/res/values-in/strings.xml @@ -0,0 +1,5 @@ + + + Selanjutnya + Impor pengaturan + diff --git a/feature/onboarding/src/main/res/values-is/strings.xml b/feature/onboarding/src/main/res/values-is/strings.xml index 3ea04e700d..cfe0fa7458 100644 --- a/feature/onboarding/src/main/res/values-is/strings.xml +++ b/feature/onboarding/src/main/res/values-is/strings.xml @@ -1,2 +1,7 @@ - + + Velkomin í Póstinn + Settu upp nýjan aðgang eða flyttu inn tölvupóstaðganga úr áður notaðri stillingaskrá. + Næsta + Flytja inn stillingar + diff --git a/feature/onboarding/src/main/res/values-it/strings.xml b/feature/onboarding/src/main/res/values-it/strings.xml index 045e125f3d..95964244f4 100644 --- a/feature/onboarding/src/main/res/values-it/strings.xml +++ b/feature/onboarding/src/main/res/values-it/strings.xml @@ -1,3 +1,7 @@ + Benvenuto in Mail + Imposta un nuovo account o importa i tuoi account da un file di impostazioni esistente. + Successivo + Importa impostazioni diff --git a/feature/onboarding/src/main/res/values-iw/strings.xml b/feature/onboarding/src/main/res/values-iw/strings.xml new file mode 100644 index 0000000000..533e69704d --- /dev/null +++ b/feature/onboarding/src/main/res/values-iw/strings.xml @@ -0,0 +1,5 @@ + + + הבא + יבא הגדרות + diff --git a/feature/onboarding/src/main/res/values-ja/strings.xml b/feature/onboarding/src/main/res/values-ja/strings.xml new file mode 100644 index 0000000000..a689339498 --- /dev/null +++ b/feature/onboarding/src/main/res/values-ja/strings.xml @@ -0,0 +1,5 @@ + + + 次へ + 設定をインポート + diff --git a/feature/onboarding/src/main/res/values-ko/strings.xml b/feature/onboarding/src/main/res/values-ko/strings.xml new file mode 100644 index 0000000000..922fa00d0c --- /dev/null +++ b/feature/onboarding/src/main/res/values-ko/strings.xml @@ -0,0 +1,5 @@ + + + 다음 + 설정 가져오기 + diff --git a/feature/onboarding/src/main/res/values-lt/strings.xml b/feature/onboarding/src/main/res/values-lt/strings.xml new file mode 100644 index 0000000000..e58019df73 --- /dev/null +++ b/feature/onboarding/src/main/res/values-lt/strings.xml @@ -0,0 +1,5 @@ + + + Kitas + Importuoti nustatymus + diff --git a/feature/onboarding/src/main/res/values-lv/strings.xml b/feature/onboarding/src/main/res/values-lv/strings.xml new file mode 100644 index 0000000000..d5a7029092 --- /dev/null +++ b/feature/onboarding/src/main/res/values-lv/strings.xml @@ -0,0 +1,5 @@ + + + Nākošais + Importēšanas iestatījumi + diff --git a/feature/onboarding/src/main/res/values-ml/strings.xml b/feature/onboarding/src/main/res/values-ml/strings.xml new file mode 100644 index 0000000000..9e2b04c862 --- /dev/null +++ b/feature/onboarding/src/main/res/values-ml/strings.xml @@ -0,0 +1,5 @@ + + + അടുത്തത് + ക്രമീകരണങ്ങൾ ഇംപോർട്ട് ചെയ്യുക + diff --git a/feature/onboarding/src/main/res/values-nb/strings.xml b/feature/onboarding/src/main/res/values-nb/strings.xml new file mode 100644 index 0000000000..efc0287ae7 --- /dev/null +++ b/feature/onboarding/src/main/res/values-nb/strings.xml @@ -0,0 +1,5 @@ + + + Neste + Importer innstillinger + diff --git a/feature/onboarding/src/main/res/values-nl/strings.xml b/feature/onboarding/src/main/res/values-nl/strings.xml index 045e125f3d..d7dd5df896 100644 --- a/feature/onboarding/src/main/res/values-nl/strings.xml +++ b/feature/onboarding/src/main/res/values-nl/strings.xml @@ -1,3 +1,7 @@ + Welkom bij Mail + Stel een nieuwe account in of importeer jouw email account vanuit een vorig configuratie bestand. + Volgende + Import instellingen diff --git a/feature/onboarding/src/main/res/values-pl/strings.xml b/feature/onboarding/src/main/res/values-pl/strings.xml new file mode 100644 index 0000000000..dcd3f91ea9 --- /dev/null +++ b/feature/onboarding/src/main/res/values-pl/strings.xml @@ -0,0 +1,5 @@ + + + Dalej + Import + diff --git a/feature/onboarding/src/main/res/values-pt-rBR/strings.xml b/feature/onboarding/src/main/res/values-pt-rBR/strings.xml new file mode 100644 index 0000000000..97ee787229 --- /dev/null +++ b/feature/onboarding/src/main/res/values-pt-rBR/strings.xml @@ -0,0 +1,5 @@ + + + Próxima + Importar configurações + diff --git a/feature/onboarding/src/main/res/values-pt-rPT/strings.xml b/feature/onboarding/src/main/res/values-pt-rPT/strings.xml new file mode 100644 index 0000000000..eb4165d34d --- /dev/null +++ b/feature/onboarding/src/main/res/values-pt-rPT/strings.xml @@ -0,0 +1,6 @@ + + + Seguinte + Importar configurações + + diff --git a/feature/onboarding/src/main/res/values-ro/strings.xml b/feature/onboarding/src/main/res/values-ro/strings.xml new file mode 100644 index 0000000000..517a3f15e2 --- /dev/null +++ b/feature/onboarding/src/main/res/values-ro/strings.xml @@ -0,0 +1,5 @@ + + + Înainte + Setări importare + diff --git a/feature/onboarding/src/main/res/values-ru/strings.xml b/feature/onboarding/src/main/res/values-ru/strings.xml index 045e125f3d..8910029d61 100644 --- a/feature/onboarding/src/main/res/values-ru/strings.xml +++ b/feature/onboarding/src/main/res/values-ru/strings.xml @@ -1,3 +1,7 @@ + Добро пожаловать + Создайте новую учетную запись или импортируйте учетные записи электронной почты из предыдущего файла настроек. + Далее + Импорт diff --git a/feature/onboarding/src/main/res/values-sk/strings.xml b/feature/onboarding/src/main/res/values-sk/strings.xml new file mode 100644 index 0000000000..49ddd40801 --- /dev/null +++ b/feature/onboarding/src/main/res/values-sk/strings.xml @@ -0,0 +1,5 @@ + + + Ďalej + Importovať nastavenia + diff --git a/feature/onboarding/src/main/res/values-sl/strings.xml b/feature/onboarding/src/main/res/values-sl/strings.xml new file mode 100644 index 0000000000..98ed590c4f --- /dev/null +++ b/feature/onboarding/src/main/res/values-sl/strings.xml @@ -0,0 +1,6 @@ + + + Naslednje + Uvozi nastavitve + + diff --git a/feature/onboarding/src/main/res/values-sq/strings.xml b/feature/onboarding/src/main/res/values-sq/strings.xml new file mode 100644 index 0000000000..2ab5237f7e --- /dev/null +++ b/feature/onboarding/src/main/res/values-sq/strings.xml @@ -0,0 +1,5 @@ + + + Pasuesi + Importo rregullime + diff --git a/feature/onboarding/src/main/res/values-sr/strings.xml b/feature/onboarding/src/main/res/values-sr/strings.xml new file mode 100644 index 0000000000..7caba3225b --- /dev/null +++ b/feature/onboarding/src/main/res/values-sr/strings.xml @@ -0,0 +1,5 @@ + + + Следеће + Увези поставке + diff --git a/feature/onboarding/src/main/res/values-sv/strings.xml b/feature/onboarding/src/main/res/values-sv/strings.xml index 045e125f3d..54fdc4973e 100644 --- a/feature/onboarding/src/main/res/values-sv/strings.xml +++ b/feature/onboarding/src/main/res/values-sv/strings.xml @@ -1,3 +1,7 @@ + Välkommen till E-post + Ställ in ett nytt konto eller importera ditt e-postkonto från en tidigare inställningsfil. + Nästa + Importera inställningar diff --git a/feature/onboarding/src/main/res/values-tr/strings.xml b/feature/onboarding/src/main/res/values-tr/strings.xml index 045e125f3d..20e71c4153 100644 --- a/feature/onboarding/src/main/res/values-tr/strings.xml +++ b/feature/onboarding/src/main/res/values-tr/strings.xml @@ -1,3 +1,6 @@ + Mail Posta\'ya Hoşgeldiniz + Sonraki + İçe Aktarma ayarları diff --git a/feature/onboarding/src/main/res/values-uk/strings.xml b/feature/onboarding/src/main/res/values-uk/strings.xml new file mode 100644 index 0000000000..0733171309 --- /dev/null +++ b/feature/onboarding/src/main/res/values-uk/strings.xml @@ -0,0 +1,5 @@ + + + Наступний + Імпортувати налаштування + diff --git a/feature/onboarding/src/main/res/values-zh-rCN/strings.xml b/feature/onboarding/src/main/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000000..cfc2d435dd --- /dev/null +++ b/feature/onboarding/src/main/res/values-zh-rCN/strings.xml @@ -0,0 +1,5 @@ + + + 前进 + 导入设置 + diff --git a/feature/onboarding/src/main/res/values-zh-rTW/strings.xml b/feature/onboarding/src/main/res/values-zh-rTW/strings.xml new file mode 100644 index 0000000000..9c06244b01 --- /dev/null +++ b/feature/onboarding/src/main/res/values-zh-rTW/strings.xml @@ -0,0 +1,5 @@ + + + 下一步 + 匯入設定 + diff --git a/feature/onboarding/src/main/res/values/strings.xml b/feature/onboarding/src/main/res/values/strings.xml index 075194c2f9..c3cd473352 100644 --- a/feature/onboarding/src/main/res/values/strings.xml +++ b/feature/onboarding/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ - Mail - Welcome to Mail, the Android email client designed for enhanced security, easy customization, and seamless management of all your email accounts. - Start + Welcome to Mail + Set up a new account or import your email accounts from a previous settings file. + Next Import settings -- GitLab From 1a98facfc94da1d0b93f3cc5adecde15cfb525f0 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Thu, 19 Oct 2023 12:38:18 +0600 Subject: [PATCH 07/18] improve onboarding page's UI --- .../designsystem/atom/button/Button.kt | 3 + .../atom/button/ButtonOutlined.kt | 2 + .../designsystem/atom/text/TextBody1.kt | 6 + .../designsystem/atom/text/TextHeadline2.kt | 5 + .../atom/textfield/TextFieldOutlined.kt | 3 + .../TextFieldOutlinedEmailAddress.kt | 3 + .../textfield/TextFieldOutlinedFakeSelect.kt | 3 + .../atom/textfield/TextFieldOutlinedNumber.kt | 3 + .../textfield/TextFieldOutlinedPassword.kt | 3 + .../atom/textfield/TextFieldOutlinedSelect.kt | 3 + .../core/ui/compose/theme/color/Colors.kt | 4 +- .../ui/compose/theme/color/CustomColor.kt | 24 +++ .../res/drawable/core_ui_theme_k9_logo.xml | 89 +++++++---- .../core_ui_theme_thunderbird_logo.xml | 89 +++++++---- .../view/AutoDiscoveryResultBodyView.kt | 2 +- feature/onboarding/build.gradle.kts | 1 + .../onboarding/ui/OnboardingContent.kt | 56 +++---- .../res/drawable/onboarding_welcome_logo.xml | 146 ++++++++++-------- 18 files changed, 287 insertions(+), 158 deletions(-) create mode 100644 core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/CustomColor.kt diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/Button.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/Button.kt index 5165145b8b..eb8f4835c6 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/Button.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/Button.kt @@ -1,11 +1,13 @@ package app.k9mail.core.ui.compose.designsystem.atom.button import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.ButtonDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.designsystem.atom.text.TextButton import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.core.ui.compose.theme.PreviewWithThemes @@ -27,6 +29,7 @@ fun Button( colors = ButtonDefaults.buttonColors( backgroundColor = color ?: MainTheme.colors.primary, ), + shape = RoundedCornerShape(6.dp), contentPadding = contentPadding, ) { TextButton(text = text) diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonOutlined.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonOutlined.kt index fcde407636..bd386ff7ff 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonOutlined.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonOutlined.kt @@ -2,6 +2,7 @@ package app.k9mail.core.ui.compose.designsystem.atom.button import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.ButtonDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -40,6 +41,7 @@ fun ButtonOutlined( ) }, ), + shape = RoundedCornerShape(6.dp), contentPadding = contentPadding, ) { TextButton(text = text) diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextBody1.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextBody1.kt index 09cacd61ee..0ea3bb0c62 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextBody1.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextBody1.kt @@ -10,6 +10,8 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.TextUnit +import androidx.compose.ui.unit.sp import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.core.ui.compose.theme.PreviewWithThemes import androidx.compose.material.Text as MaterialText @@ -20,6 +22,8 @@ fun TextBody1( modifier: Modifier = Modifier, color: Color = Color.Unspecified, textAlign: TextAlign? = null, + fontSize: TextUnit = TextUnit.Unspecified, + fontWeight: FontWeight? = null, ) { MaterialText( text = text, @@ -27,6 +31,8 @@ fun TextBody1( color = color, textAlign = textAlign, style = MainTheme.typography.body1, + fontSize = fontSize, + fontWeight = fontWeight, ) } diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextHeadline2.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextHeadline2.kt index eabd641148..83dcbe767b 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextHeadline2.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/text/TextHeadline2.kt @@ -10,6 +10,7 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.TextUnit import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.core.ui.compose.theme.PreviewWithThemes import androidx.compose.material.Text as MaterialText @@ -20,6 +21,8 @@ fun TextHeadline2( modifier: Modifier = Modifier, color: Color = Color.Unspecified, textAlign: TextAlign? = null, + fontSize: TextUnit = TextUnit.Unspecified, + fontWeight: FontWeight? = null, ) { MaterialText( text = text, @@ -27,6 +30,8 @@ fun TextHeadline2( color = color, textAlign = textAlign, style = MainTheme.typography.h2, + fontSize = fontSize, + fontWeight = fontWeight, ) } diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlined.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlined.kt index 79ebb45ab1..ec6a7dc718 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlined.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlined.kt @@ -1,8 +1,10 @@ package app.k9mail.core.ui.compose.designsystem.atom.textfield +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.designsystem.atom.Icon import app.k9mail.core.ui.compose.theme.Icons import app.k9mail.core.ui.compose.theme.PreviewWithThemes @@ -23,6 +25,7 @@ fun TextFieldOutlined( isSingleLine: Boolean = true, ) { MaterialOutlinedTextField( + shape = RoundedCornerShape(6.dp), value = value, onValueChange = onValueChange, modifier = modifier, diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedEmailAddress.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedEmailAddress.kt index abf2d929ba..17fa304504 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedEmailAddress.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedEmailAddress.kt @@ -1,10 +1,12 @@ package app.k9mail.core.ui.compose.designsystem.atom.textfield +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.theme.PreviewWithThemes import androidx.compose.material.OutlinedTextField as MaterialOutlinedTextField @@ -21,6 +23,7 @@ fun TextFieldOutlinedEmailAddress( hasError: Boolean = false, ) { MaterialOutlinedTextField( + shape = RoundedCornerShape(6.dp), value = value, onValueChange = onValueChange, modifier = modifier, diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedFakeSelect.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedFakeSelect.kt index 2ccee8475c..ba4f1e1d0f 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedFakeSelect.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedFakeSelect.kt @@ -3,12 +3,14 @@ package app.k9mail.core.ui.compose.designsystem.atom.textfield import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.PressInteraction import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.designsystem.atom.Icon import app.k9mail.core.ui.compose.theme.Icons import app.k9mail.core.ui.compose.theme.PreviewWithThemes @@ -22,6 +24,7 @@ fun TextFieldOutlinedFakeSelect( label: String? = null, ) { MaterialOutlinedTextField( + shape = RoundedCornerShape(6.dp), value = text, onValueChange = { }, modifier = Modifier diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedNumber.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedNumber.kt index 25ee4e7a8c..7bae357a82 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedNumber.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedNumber.kt @@ -1,10 +1,12 @@ package app.k9mail.core.ui.compose.designsystem.atom.textfield +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.theme.PreviewWithThemes import androidx.compose.material.OutlinedTextField as MaterialOutlinedTextField @@ -21,6 +23,7 @@ fun TextFieldOutlinedNumber( hasError: Boolean = false, ) { MaterialOutlinedTextField( + shape = RoundedCornerShape(6.dp), value = value?.toString() ?: "", onValueChange = { onValueChange( diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedPassword.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedPassword.kt index 55cb251608..9d02ae8ba1 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedPassword.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedPassword.kt @@ -1,5 +1,6 @@ package app.k9mail.core.ui.compose.designsystem.atom.textfield +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.Icon import androidx.compose.material.IconButton @@ -14,6 +15,7 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.designsystem.R import app.k9mail.core.ui.compose.theme.Icons import app.k9mail.core.ui.compose.theme.PreviewWithThemes @@ -34,6 +36,7 @@ fun TextFieldOutlinedPassword( var passwordVisibilityState by rememberSaveable { mutableStateOf(false) } MaterialOutlinedTextField( + shape = RoundedCornerShape(6.dp), value = value, onValueChange = onValueChange, modifier = modifier, diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedSelect.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedSelect.kt index 8670301753..650306914b 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedSelect.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/textfield/TextFieldOutlinedSelect.kt @@ -2,6 +2,7 @@ package app.k9mail.core.ui.compose.designsystem.atom.textfield import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.DropdownMenuItem import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.ExposedDropdownMenuBox @@ -11,6 +12,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.designsystem.atom.Icon import app.k9mail.core.ui.compose.theme.Icons import app.k9mail.core.ui.compose.theme.PreviewWithThemes @@ -39,6 +41,7 @@ fun TextFieldOutlinedSelect( onValueChange = onValueChange, ) { expanded -> MaterialOutlinedTextField( + shape = RoundedCornerShape(6.dp), value = optionToStringTransformation(selectedOption), onValueChange = { }, modifier = Modifier diff --git a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt index 85d20a6d32..ca60eae43b 100644 --- a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt +++ b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/Colors.kt @@ -114,8 +114,8 @@ internal fun eOsColors(context: Context, isLight: Boolean): Colors { background = Color(ContextCompat.getColor(context, R.color.e_background)), surface = Color(ContextCompat.getColor(context, R.color.e_floating_background)), success = Color(ContextCompat.getColor(context, R.color.e_accent_green)), - error = Color(ContextCompat.getColor(context, R.color.e_error)), - warning = if (isLight) MaterialColor.orange_600 else MaterialColor.orange_300, + error = CustomColor.error_red, + warning = CustomColor.warning_orange, info = if (isLight) MaterialColor.yellow_600 else MaterialColor.yellow_300, onPrimary = Color(ContextCompat.getColor(context, R.color.e_background)), onSecondary = Color(ContextCompat.getColor(context, R.color.e_background)), diff --git a/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/CustomColor.kt b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/CustomColor.kt new file mode 100644 index 0000000000..06e85bb809 --- /dev/null +++ b/core/ui/compose/theme/src/main/java/app/k9mail/core/ui/compose/theme/color/CustomColor.kt @@ -0,0 +1,24 @@ +/* + * Copyright MURENA SAS 2023 + * 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 app.k9mail.core.ui.compose.theme.color + +import androidx.compose.ui.graphics.Color + +internal object CustomColor { + val warning_orange = Color(color = 0xFFFF7A00) + val error_red = Color(color = 0xFFF8432E) +} diff --git a/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_k9_logo.xml b/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_k9_logo.xml index b95a04662b..c4907d00ba 100644 --- a/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_k9_logo.xml +++ b/core/ui/compose/theme/src/main/res/drawable/core_ui_theme_k9_logo.xml @@ -1,5 +1,4 @@ - -