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

Unverified Commit f1c82f57 authored by Wolf-Martell Montwé's avatar Wolf-Martell Montwé Committed by GitHub
Browse files

Merge pull request #6781 from thundernest/change_theme_to_custom_colors

Change theme to custom colors
parents fe267691 4218ce5c
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -183,7 +183,6 @@
    <ID>LongParameterList:RecipientPresenter.kt$RecipientPresenter$( private val context: Context, loaderManager: LoaderManager, private val openPgpApiManager: OpenPgpApiManager, private val recipientMvpView: RecipientMvpView, account: Account, private val composePgpInlineDecider: ComposePgpInlineDecider, private val composePgpEnableByDefaultDecider: ComposePgpEnableByDefaultDecider, private val autocryptStatusInteractor: AutocryptStatusInteractor, private val replyToParser: ReplyToParser, private val draftStateHeaderParser: AutocryptDraftStateHeaderParser, )</ID>
    <ID>LongParameterList:SaveMessageOperationsTest.kt$SaveMessageOperationsTest$( subject: String? = getSubject(), date: Long = sentDate?.time ?: System.currentTimeMillis(), internalDate: Long = date, downloadState: MessageDownloadState = getDownloadState(), attachmentCount: Int = 0, previewResult: PreviewResult = PreviewResult.none(), textForSearchIndex: String? = null, encryptionType: String? = null, )</ID>
    <ID>LongParameterList:SettingsImportViewModel.kt$SavedAccountState$( val accountIndex: Int, val displayName: String, val accountUuid: String, val selected: Boolean, val importStatus: ImportStatus, val incomingServerName: String?, val outgoingServerName: String?, val incomingServerPasswordNeeded: Boolean, val outgoingServerPasswordNeeded: Boolean, )</ID>
    <ID>LongParameterList:Typography.kt$( h1: TextStyle, h2: TextStyle, h3: TextStyle, h4: TextStyle, h5: TextStyle, h6: TextStyle, subtitle1: TextStyle, subtitle2: TextStyle, body1: TextStyle, body2: TextStyle, button: TextStyle, caption: TextStyle, overline: TextStyle, )</ID>
    <ID>LoopWithTooManyJumpStatements:AccountSetupCheckSettings.kt$AccountSetupCheckSettings$for (subjectAlternativeName in subjectAlternativeNames) { val type = subjectAlternativeName[0] as Int val value: Any? = subjectAlternativeName[1] val name: String = when (type) { 0 -&gt; { Timber.w("SubjectAltName of type OtherName not supported.") continue } 1 -&gt; value as String 2 -&gt; value as String 3 -&gt; { Timber.w("unsupported SubjectAltName of type x400Address") continue } 4 -&gt; { Timber.w("unsupported SubjectAltName of type directoryName") continue } 5 -&gt; { Timber.w("unsupported SubjectAltName of type ediPartyName") continue } 6 -&gt; value as String 7 -&gt; value as String else -&gt; { Timber.w("unsupported SubjectAltName of unknown type") continue } } // if some of the SubjectAltNames match the store or transport -host, display them if (name.equals(incomingServerHost, ignoreCase = true) || name.equals(outgoingServerHost, ignoreCase = true) ) { // TODO: localize this string altNamesText.append("Subject(alt): ").append(name).append(",...\n") } else if (name.startsWith("*.") &amp;&amp; ( incomingServerHost.endsWith(name.substring(2)) || outgoingServerHost.endsWith(name.substring(2)) ) ) { // TODO: localize this string altNamesText.append("Subject(alt): ").append(name).append(",...\n") } }</ID>
    <ID>LoopWithTooManyJumpStatements:HttpUriParser.kt$HttpUriParser$while (currentPos &lt; text.length) { val c = text[currentPos] if (isHexDigit(c)) { shouldBeHex = (shouldBeHex - 1).coerceAtLeast(0) } else if (shouldBeHex == 0) { if (c in allowedCharacters) { // Everything ok here :) } else if (c == '%') { shouldBeHex = 2 } else { break } } else { break } currentPos++ }</ID>
    <ID>LoopWithTooManyJumpStatements:RealImapStore.kt$RealImapStore$for (listResponse in listResponses) { val serverId = listResponse.name if (pathDelimiter == null) { pathDelimiter = listResponse.hierarchyDelimiter combinedPrefix = null } if (RealImapFolder.INBOX.equals(serverId, ignoreCase = true)) { continue } else if (listResponse.hasAttribute("\\NoSelect")) { continue } val name = getFolderDisplayName(serverId) val oldServerId = getOldServerId(serverId) val type = when { listResponse.hasAttribute("\\Archive") -&gt; FolderType.ARCHIVE listResponse.hasAttribute("\\All") -&gt; FolderType.ARCHIVE listResponse.hasAttribute("\\Drafts") -&gt; FolderType.DRAFTS listResponse.hasAttribute("\\Sent") -&gt; FolderType.SENT listResponse.hasAttribute("\\Junk") -&gt; FolderType.SPAM listResponse.hasAttribute("\\Trash") -&gt; FolderType.TRASH else -&gt; FolderType.REGULAR } val existingItem = folderMap[serverId] if (existingItem == null || existingItem.type == FolderType.REGULAR) { folderMap[serverId] = FolderListItem(serverId, name, type, oldServerId) } }</ID>
@@ -462,8 +461,6 @@
    <ID>MagicNumber:ThemeManager.kt$ThemeManager$28</ID>
    <ID>MagicNumber:ThreadMessageOperations.kt$ThreadMessageOperations$3</ID>
    <ID>MagicNumber:TimberLogger.kt$TimberLogger$26</ID>
    <ID>MagicNumber:Typography.kt$0.5</ID>
    <ID>MagicNumber:Typography.kt$1.5</ID>
    <ID>MagicNumber:UidValidityResponse.kt$UidValidityResponse.Companion$0xFFFFFFFFL</ID>
    <ID>MagicNumber:Utf8.kt$0x010000</ID>
    <ID>MagicNumber:Utf8.kt$0x10000</ID>
+1 −1
Original line number Diff line number Diff line
@@ -729,7 +729,7 @@ style:
Compose:
  CompositionLocalAllowlist:
    active: true
    allowedCompositionLocals: [LocalElevations, LocalImages, LocalSizes, LocalSpacings]
    allowedCompositionLocals: [LocalColors, LocalElevations, LocalImages, LocalSizes, LocalSpacings]
  ContentEmitterReturningValues:
    active: true
    # You can optionally add your own composables here
+118 −0
Original line number Diff line number Diff line
package app.k9mail.core.ui.compose.theme

import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.material.Colors as MaterialColors

@Immutable
data class Colors(
    val primary: Color,
    val primaryVariant: Color,
    val secondary: Color,
    val secondaryVariant: Color,
    val background: Color,
    val surface: Color,
    val success: Color,
    val error: Color,
    val warning: Color,
    val info: Color,
    val onPrimary: Color,
    val onSecondary: Color,
    val onBackground: Color,
    val onSurface: Color,
    val onMessage: Color,
    val isLight: Boolean,
)

@Suppress("LongParameterList")
internal fun lightColors(
    primary: Color = MaterialColor.deep_purple_600,
    primaryVariant: Color = MaterialColor.deep_purple_900,
    secondary: Color = MaterialColor.cyan_600,
    secondaryVariant: Color = MaterialColor.cyan_800,
    background: Color = MaterialColor.gray_200,
    surface: Color = Color.White,
    success: Color = MaterialColor.green_600,
    error: Color = MaterialColor.red_600,
    warning: Color = MaterialColor.orange_600,
    info: Color = MaterialColor.yellow_600,
    onPrimary: Color = Color.White,
    onSecondary: Color = Color.Black,
    onBackground: Color = Color.Black,
    onSurface: Color = Color.Black,
    onMessage: Color = Color.White,
) = Colors(
    primary = primary,
    primaryVariant = primaryVariant,
    secondary = secondary,
    secondaryVariant = secondaryVariant,
    background = background,
    surface = surface,
    success = success,
    error = error,
    warning = warning,
    info = info,
    onPrimary = onPrimary,
    onSecondary = onSecondary,
    onBackground = onBackground,
    onSurface = onSurface,
    onMessage = onMessage,
    isLight = true,
)

@Suppress("LongParameterList")
internal fun darkColors(
    primary: Color = MaterialColor.deep_purple_200,
    primaryVariant: Color = MaterialColor.deep_purple_50,
    secondary: Color = MaterialColor.cyan_300,
    secondaryVariant: Color = MaterialColor.cyan_100,
    background: Color = MaterialColor.gray_800,
    surface: Color = MaterialColor.gray_900,
    success: Color = MaterialColor.green_300,
    error: Color = MaterialColor.red_300,
    warning: Color = MaterialColor.orange_300,
    info: Color = MaterialColor.yellow_300,
    onPrimary: Color = Color.Black,
    onSecondary: Color = Color.Black,
    onBackground: Color = Color.White,
    onSurface: Color = Color.White,
    onMessage: Color = Color.Black,
) = Colors(
    primary = primary,
    primaryVariant = primaryVariant,
    secondary = secondary,
    secondaryVariant = secondaryVariant,
    background = background,
    surface = surface,
    success = success,
    error = error,
    warning = warning,
    info = info,
    onPrimary = onPrimary,
    onSecondary = onSecondary,
    onBackground = onBackground,
    onSurface = onSurface,
    onMessage = onMessage,
    isLight = false,
)

internal fun Colors.toMaterialColors(): MaterialColors {
    return MaterialColors(
        primary = primary,
        primaryVariant = primaryVariant,
        secondary = secondary,
        secondaryVariant = secondaryVariant,
        background = background,
        surface = surface,
        error = error,
        onPrimary = onPrimary,
        onSecondary = onSecondary,
        onBackground = onBackground,
        onSurface = onSurface,
        onError = onMessage,
        isLight = isLight,
    )
}

internal val LocalColors = staticCompositionLocalOf { lightColors() }
+8 −10
Original line number Diff line number Diff line
package app.k9mail.core.ui.compose.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.runtime.Composable

private val k9LightColorPalette = lightColors(
    primary = material_gray_800,
    primaryVariant = material_gray_700,
    secondary = material_pink_500,
    secondaryVariant = material_pink_300,
    primary = MaterialColor.gray_800,
    primaryVariant = MaterialColor.gray_700,
    secondary = MaterialColor.pink_500,
    secondaryVariant = MaterialColor.pink_300,
)

private val k9DarkColorPalette = darkColors(
    primary = material_gray_100,
    primaryVariant = material_gray_50,
    secondary = material_pink_300,
    secondaryVariant = material_pink_500,
    primary = MaterialColor.gray_100,
    primaryVariant = MaterialColor.gray_50,
    secondary = MaterialColor.pink_300,
    secondaryVariant = MaterialColor.pink_500,
)

@Composable
+3 −3
Original line number Diff line number Diff line
package app.k9mail.core.ui.compose.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.Colors
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Shapes
import androidx.compose.material.Typography
@@ -30,13 +29,14 @@ fun MainTheme(
    }

    CompositionLocalProvider(
        LocalColors provides colors,
        LocalElevations provides Elevations(),
        LocalImages provides images,
        LocalSizes provides Sizes(),
        LocalSpacings provides Spacings(),
    ) {
        MaterialTheme(
            colors = colors,
            colors = colors.toMaterialColors(),
            typography = typography,
            shapes = shapes,
            content = content,
@@ -48,7 +48,7 @@ object MainTheme {
    val colors: Colors
        @Composable
        @ReadOnlyComposable
        get() = MaterialTheme.colors
        get() = LocalColors.current

    val typography: Typography
        @Composable
Loading