Skip to content

Commit

Permalink
Fixed surface container color in dark theme (#1069)
Browse files Browse the repository at this point in the history
* Fixed surface color in dark theme

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>

* Account screen: higher contrast for collection cards

* Account screen: use normal instead of elevated cards

* Adapt colors of card lists

---------

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Co-authored-by: Ricki Hirner <hirner@bitfire.at>
  • Loading branch information
ArnyminerZ and rfc2822 authored Oct 14, 2024
1 parent a888342 commit a0d152a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.material.icons.filled.Contacts
import androidx.compose.material.icons.filled.RemoveCircle
import androidx.compose.material.icons.filled.Task
import androidx.compose.material.icons.filled.Today
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -112,7 +113,9 @@ fun CollectionList_Item(
modifier = modifier.clickable(onClick = onShowDetails)

ElevatedCard(
modifier = modifier
colors = CardDefaults.elevatedCardColors(
containerColor = MaterialTheme.colorScheme.surfaceContainer
)
) {
Row(Modifier.height(IntrinsicSize.Max)) {
Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -174,7 +175,7 @@ fun WebdavMountsScreen(
Spacer(Modifier.height(4.dp))

LazyColumn(
verticalArrangement = Arrangement.spacedBy(8.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier
.fillMaxSize()
.padding(8.dp)
Expand Down Expand Up @@ -253,8 +254,10 @@ fun WebdavMountsItem(
)
}

Card(
modifier = Modifier.fillMaxWidth()
ElevatedCard(
colors = CardDefaults.elevatedCardColors(
containerColor = MaterialTheme.colorScheme.surfaceContainer
)
) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -349,33 +352,59 @@ fun WebdavMountsItem(
@Composable
@Preview
fun WebdavMountsScreen_Preview_Empty() {
WebdavMountsScreen(
mountInfos = emptyList(),
refreshingQuota = false
)
AppTheme {
WebdavMountsScreen(
mountInfos = emptyList(),
refreshingQuota = false
)
}
}

@Composable
@Preview
fun WebdavMountsScreen_Preview_TwoMounts() {
WebdavMountsScreen(
mountInfos = listOf(
WebDavMountWithQuota(
mount = WebDavMount(
id = 0,
name = "Preview Webdav Mount 1",
url = HttpUrl.Builder()
.scheme("https")
.host("example.com")
.build()
AppTheme {
WebdavMountsScreen(
mountInfos = listOf(
WebDavMountWithQuota(
mount = WebDavMount(
id = 0,
name = "Preview Webdav Mount 1",
url = HttpUrl.Builder()
.scheme("https")
.host("example.com")
.build()
),
quotaAvailable = 1024 * 1024 * 1024,
quotaUsed = 512 * 1024 * 1024
),
quotaAvailable = 1024 * 1024 * 1024,
quotaUsed = 512 * 1024 * 1024
WebDavMountWithQuota(
mount = WebDavMount(
id = 1,
name = "Preview Webdav Mount 2",
url = HttpUrl.Builder()
.scheme("https")
.host("example.com")
.build()
),
quotaAvailable = 1024 * 1024 * 1024,
quotaUsed = 512 * 1024 * 1024
)
),
WebDavMountWithQuota(
refreshingQuota = true
)
}
}

@Composable
@Preview
fun WebdavMountsItem_Preview() {
AppTheme {
WebdavMountsItem(
info = WebDavMountWithQuota(
mount = WebDavMount(
id = 1,
name = "Preview Webdav Mount 2",
id = 0,
name = "Preview Webdav Mount",
url = HttpUrl.Builder()
.scheme("https")
.host("example.com")
Expand All @@ -384,28 +413,8 @@ fun WebdavMountsScreen_Preview_TwoMounts() {
quotaAvailable = 1024 * 1024 * 1024,
quotaUsed = 512 * 1024 * 1024
)
),
refreshingQuota = true
)
}

@Composable
@Preview
fun WebdavMountsItem_Preview() {
WebdavMountsItem(
info = WebDavMountWithQuota(
mount = WebDavMount(
id = 0,
name = "Preview Webdav Mount",
url = HttpUrl.Builder()
.scheme("https")
.host("example.com")
.build()
),
quotaAvailable = 1024 * 1024 * 1024,
quotaUsed = 512 * 1024 * 1024
)
)
}
}


Expand Down
2 changes: 1 addition & 1 deletion app/src/ose/kotlin/at/bitfire/davdroid/ui/ThemeColors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ object M3ColorScheme {
val surfaceBrightDark = Color(0xFF4d4d4d)
val surfaceContainerLowestDark = Color(0xFF141414)
val surfaceContainerLowDark = Color(0xFF1f1f1f)
val surfaceContainerDark = Color(0xFFf5f5f5)
val surfaceContainerDark = Color(0xff3a3a3a)
val surfaceContainerHighDark = Color(0xFF383838)
val surfaceContainerHighestDark = Color(0xFF434343)

Expand Down

0 comments on commit a0d152a

Please sign in to comment.