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

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

Merge pull request #8136 from wmontwe/add-drawer-account-top-view

Add drawer account view
parents 89381dbe 3e1c976a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,4 +113,4 @@ private fun ColorScheme.toDynamicThemeColorScheme(
    )
}

private fun Color.toHarmonizedColor(target: Color) = Color(MaterialColors.harmonize(toArgb(), target.toArgb()))
fun Color.toHarmonizedColor(target: Color) = Color(MaterialColors.harmonize(toArgb(), target.toArgb()))
+20 −1
Original line number Diff line number Diff line
@@ -3,11 +3,30 @@ package app.k9mail.feature.navigation.drawer.ui
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithTheme
import app.k9mail.feature.navigation.drawer.ui.account.FakeData.DISPLAY_ACCOUNT

@Composable
@Preview(showBackground = true)
internal fun DrawerContentPreview() {
    PreviewWithTheme {
        DrawerContent()
        DrawerContent(
            state = DrawerContract.State(
                accounts = emptyList(),
                currentAccount = null,
            ),
        )
    }
}

@Composable
@Preview(showBackground = true)
fun DrawerContentWithAccountPreview() {
    PreviewWithTheme {
        DrawerContent(
            state = DrawerContract.State(
                accounts = listOf(DISPLAY_ACCOUNT),
                currentAccount = DISPLAY_ACCOUNT,
            ),
        )
    }
}
+43 −0
Original line number Diff line number Diff line
package app.k9mail.feature.navigation.drawer.ui.account

import androidx.compose.foundation.layout.height
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithThemes
import app.k9mail.core.ui.compose.theme2.MainTheme

@Composable
@Preview(showBackground = true)
internal fun AccountIndicatorPreview() {
    PreviewWithThemes {
        AccountIndicator(
            accountColor = 0,
            modifier = Modifier.height(MainTheme.spacings.double),
        )
    }
}

@Composable
@Preview(showBackground = true)
internal fun AccountIndicatorPreviewWithYellowAccountColor() {
    PreviewWithThemes {
        AccountIndicator(
            accountColor = Color.Yellow.toArgb(),
            modifier = Modifier.height(MainTheme.spacings.double),
        )
    }
}

@Composable
@Preview(showBackground = true)
internal fun AccountIndicatorPreviewWithGrayAccountColor() {
    PreviewWithThemes {
        AccountIndicator(
            accountColor = Color.Gray.toArgb(),
            modifier = Modifier.height(MainTheme.spacings.double),
        )
    }
}
+56 −0
Original line number Diff line number Diff line
package app.k9mail.feature.navigation.drawer.ui.account

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithThemes
import app.k9mail.feature.navigation.drawer.ui.account.FakeData.DISPLAY_NAME
import app.k9mail.feature.navigation.drawer.ui.account.FakeData.EMAIL_ADDRESS
import app.k9mail.feature.navigation.drawer.ui.account.FakeData.LONG_TEXT

@Composable
@Preview(showBackground = true)
internal fun AccountViewPreview() {
    PreviewWithThemes {
        AccountView(
            displayName = DISPLAY_NAME,
            emailAddress = EMAIL_ADDRESS,
            accountColor = 0,
        )
    }
}

@Composable
@Preview(showBackground = true)
internal fun AccountViewWithColorPreview() {
    PreviewWithThemes {
        AccountView(
            displayName = DISPLAY_NAME,
            emailAddress = EMAIL_ADDRESS,
            accountColor = 0xFF0000,
        )
    }
}

@Composable
@Preview(showBackground = true)
internal fun AccountViewWithLongDisplayName() {
    PreviewWithThemes {
        AccountView(
            displayName = "$LONG_TEXT $DISPLAY_NAME",
            emailAddress = EMAIL_ADDRESS,
            accountColor = 0,
        )
    }
}

@Composable
@Preview(showBackground = true)
internal fun AccountViewWithLongEmailPreview() {
    PreviewWithThemes {
        AccountView(
            displayName = DISPLAY_NAME,
            emailAddress = "$LONG_TEXT@example.com",
            accountColor = 0,
        )
    }
}
+37 −0
Original line number Diff line number Diff line
package app.k9mail.feature.navigation.drawer.ui.account

import app.k9mail.feature.navigation.drawer.domain.entity.DisplayAccount
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.account.Identity

internal object FakeData {

    const val ACCOUNT_UUID = "uuid"
    const val DISPLAY_NAME = "Account Name"
    const val EMAIL_ADDRESS = "test@example.com"

    const val LONG_TEXT = "loremipsumdolorsitametconsetetursadipscingelitr" +
        "seddiamnonumyeirmodtemporinviduntutlaboreetdoloremagnaaliquyameratseddiamvoluptua"

    val ACCOUNT = Account(
        uuid = ACCOUNT_UUID,
    ).apply {
        identities = ArrayList()

        val identity = Identity(
            signatureUse = false,
            signature = "",
            description = "",
        )
        identities.add(identity)

        name = DISPLAY_NAME
        email = EMAIL_ADDRESS
    }

    val DISPLAY_ACCOUNT = DisplayAccount(
        account = ACCOUNT,
        unreadMessageCount = 0,
        starredMessageCount = 0,
    )
}
Loading