Added support for dynamic colors on most of main screen

This commit is contained in:
Juha Heinanen
2025-10-15 12:52:48 +03:00
parent dd0d9fba87
commit 4b00b09683
19 changed files with 60 additions and 32 deletions

View File

@ -45,18 +45,20 @@ fun AppTheme(
val customColorsPalette = basePalette.copy(
background = colorScheme.background,
onBackground = if (useActualDynamicColors)
colorScheme.onBackground
else
basePalette.onBackground,
cardBackground = colorScheme.surfaceVariant,
textFieldBackground = colorScheme.surfaceVariant,
primary = if (useActualDynamicColors) {
primary = if (useActualDynamicColors)
colorScheme.primary
} else {
basePalette.primary
},
onPrimary = if (useActualDynamicColors) {
else
basePalette.primary,
onPrimary = if (useActualDynamicColors)
colorScheme.onPrimary
} else {
else
basePalette.onPrimary
}
)
val view = LocalView.current

View File

@ -35,6 +35,7 @@ data class CustomColors(
val alertText: Color = Color.Unspecified,
val codec: Color = Color.Unspecified,
val background: Color = Color.Unspecified,
val onBackground: Color = Color.Unspecified,
val cardBackground: Color = Color.Unspecified,
val textFieldBackground: Color = Color.Unspecified,
val popupBackground: Color = Color.Unspecified,
@ -58,6 +59,8 @@ val light_dark = Color(0xFF383838)
val light_spinner_divider = light_gray
val light_item_text = light_dark
val light_background = light_light
val light_on_background = Color(0xFF00B9A1)
val light_textfield_background = light_gray_light
val light_card_background = light_gray_light
val light_popup_background = light_secondary_dark
@ -79,6 +82,7 @@ val dark_dark = Color(0xFF121212)
val dark_spinner_divider = dark_gray_dark
val dark_item_text = dark_gray_light
val dark_background = dark_dark
val dark_on_background = Color(0xFF00B9A1)
val dark_textfield_background = dark_gray
val dark_card_background = dark_gray_dark
val dark_popup_background = dark_secondary_dark
@ -101,6 +105,7 @@ val LightCustomColors = CustomColors(
spinnerDivider = light_spinner_divider,
itemText = light_item_text,
background = light_background,
onBackground = light_on_background,
cardBackground = light_card_background,
textFieldBackground = light_textfield_background,
popupBackground = light_popup_background,
@ -124,6 +129,7 @@ val DarkCustomColors = CustomColors(
spinnerDivider = dark_spinner_divider,
itemText = dark_item_text,
background = dark_background,
onBackground = dark_on_background,
cardBackground = dark_card_background,
textFieldBackground = dark_textfield_background,
popupBackground = dark_popup_background,

View File

@ -148,7 +148,7 @@ object CustomElements {
DropdownMenu(
expanded = expanded,
onDismissRequest = onDismissRequest,
containerColor = LocalCustomColors.current.grayLight,
containerColor = LocalCustomColors.current.onPrimary,
modifier = Modifier.background(
LocalCustomColors.current.popupBackground.copy(alpha = 0.95f)
)

View File

@ -556,7 +556,10 @@ private fun TopAppBar(
showAlert.value = true
}
),
tint = Color.Unspecified,
tint = if (BaresipService.isRecOn)
LocalCustomColors.current.accent
else
LocalCustomColors.current.onPrimary,
contentDescription = null
)
@ -585,7 +588,10 @@ private fun TopAppBar(
showAlert.value = true
},
),
tint = Color.Unspecified,
tint = if (BaresipService.isMicMuted)
LocalCustomColors.current.accent
else
LocalCustomColors.current.onPrimary,
contentDescription = null
)
@ -616,7 +622,10 @@ private fun TopAppBar(
showAlert.value = true
},
),
tint = Color.Unspecified,
tint = if (Utils.isSpeakerPhoneOn(am))
LocalCustomColors.current.accent
else
LocalCustomColors.current.onPrimary,
contentDescription = null
)
@ -628,7 +637,7 @@ private fun TopAppBar(
Icon(
imageVector = Icons.Filled.Menu,
contentDescription = "Menu",
tint = LocalCustomColors.current.light
tint = LocalCustomColors.current.onPrimary
)
}
@ -705,7 +714,10 @@ private fun BottomBar(ctx: Context, viewModel: ViewModel, navController: NavCont
imageVector = ImageVector.vectorResource(vmIcon),
contentDescription = null,
Modifier.size(buttonSize),
tint = Color.Unspecified
tint = if (vmIcon == R.drawable.voicemail)
LocalCustomColors.current.onBackground
else
LocalCustomColors.current.accent
)
}
@ -719,7 +731,7 @@ private fun BottomBar(ctx: Context, viewModel: ViewModel, navController: NavCont
imageVector = ImageVector.vectorResource(R.drawable.contacts),
contentDescription = null,
Modifier.size(buttonSize),
tint = LocalCustomColors.current.secondary
tint = LocalCustomColors.current.onBackground
)
}
@ -736,7 +748,10 @@ private fun BottomBar(ctx: Context, viewModel: ViewModel, navController: NavCont
imageVector = ImageVector.vectorResource(messagesIcon),
contentDescription = null,
Modifier.size(buttonSize),
tint = Color.Unspecified
tint = if (messagesIcon == R.drawable.messages)
LocalCustomColors.current.onBackground
else
LocalCustomColors.current.accent
)
}
@ -753,7 +768,10 @@ private fun BottomBar(ctx: Context, viewModel: ViewModel, navController: NavCont
imageVector = ImageVector.vectorResource(callsIcon),
contentDescription = null,
Modifier.size(buttonSize),
tint = Color.Unspecified
tint = if (callsIcon == R.drawable.calls)
LocalCustomColors.current.onBackground
else
LocalCustomColors.current.accent
)
}
@ -773,7 +791,10 @@ private fun BottomBar(ctx: Context, viewModel: ViewModel, navController: NavCont
imageVector = ImageVector.vectorResource(dialpadIcon),
contentDescription = null,
modifier = Modifier.size(buttonSize),
tint = Color.Unspecified
tint = if (dialpadIcon == R.drawable.dialpad_off)
LocalCustomColors.current.onBackground
else
LocalCustomColors.current.accent
)
}
}

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorSecondary"
<vector android:height="48dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorAccent"
<vector android:height="48dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorSecondary"
<vector android:height="48dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="40dp" android:tint="@color/colorSecondary"
<vector android:height="40dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,19c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,1c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,5c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,1c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="40dp" android:tint="@color/colorAccent"
<vector android:height="40dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,19c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,1c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM6,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,5c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,13c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,7c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,1c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="44dp" android:tint="@color/colorSecondary"
<vector android:height="44dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="44dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM6,9h12v2L6,11L6,9zM14,14L6,14v-2h8v2zM18,8L6,8L6,6h12v2z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="44dp" android:tint="@color/colorAccent"
<vector android:height="44dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="44dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM6,9h12v2L6,11L6,9zM14,14L6,14v-2h8v2zM18,8L6,8L6,6h12v2z"/>

View File

@ -1,5 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="@color/colorAccent"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24"

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorGrayLight"
<vector android:height="48dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,14c1.66,0 2.99,-1.34 2.99,-3L15,5c0,-1.66 -1.34,-3 -3,-3S9,3.34 9,5v6c0,1.66 1.34,3 3,3zM17.3,11c0,3 -2.54,5.1 -5.3,5.1S6.7,14 6.7,11L5,11c0,3.41 2.72,6.23 6,6.72L11,21h2v-3.28c3.28,-0.48 6,-3.3 6,-6.72h-1.7z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorGrayLight"
<vector android:height="48dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12.99,9.18c0,-0.06 0.01,-0.12 0.01,-0.18 0,-2.21 -1.79,-4 -4,-4 -0.06,0 -0.12,0.01 -0.18,0.01l4.17,4.17zM6.89,5.62L4.27,3 3,4.27l2.62,2.62C5.23,7.5 5,8.22 5,9c0,2.21 1.79,4 4,4 0.78,0 1.5,-0.23 2.11,-0.62L19.73,21 21,19.73l-8.62,-8.62 -5.49,-5.49zM9,15c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4zM16.76,5.36l-1.68,1.69c0.84,1.18 0.84,2.71 0,3.89l1.68,1.69c2.02,-2.02 2.02,-5.07 0,-7.27zM20.07,2l-1.63,1.63c2.77,3.02 2.77,7.56 0,10.74L20.07,16c3.9,-3.89 3.91,-9.95 0,-14z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorAccent"
<vector android:height="48dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M9,9m-4,0a4,4 0,1 1,8 0a4,4 0,1 1,-8 0"/>

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorGrayLight"
<vector android:height="48dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M7,7.07L8.43,8.5c0.91,-0.91 2.18,-1.48 3.57,-1.48s2.66,0.57 3.57,1.48L17,7.07C15.72,5.79 13.95,5 12,5s-3.72,0.79 -5,2.07zM12,1C8.98,1 6.24,2.23 4.25,4.21l1.41,1.41C7.28,4 9.53,3 12,3s4.72,1 6.34,2.62l1.41,-1.41C17.76,2.23 15.02,1 12,1zM14.86,10.01L9.14,10C8.51,10 8,10.51 8,11.14v9.71c0,0.63 0.51,1.14 1.14,1.14h5.71c0.63,0 1.14,-0.51 1.14,-1.14v-9.71c0.01,-0.63 -0.5,-1.13 -1.13,-1.13zM15,20L9,20v-8h6v8z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorAccent"
<vector android:height="48dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M7,7.07L8.43,8.5c0.91,-0.91 2.18,-1.48 3.57,-1.48s2.66,0.57 3.57,1.48L17,7.07C15.72,5.79 13.95,5 12,5s-3.72,0.79 -5,2.07zM12,1C8.98,1 6.24,2.23 4.25,4.21l1.41,1.41C7.28,4 9.53,3 12,3s4.72,1 6.34,2.62l1.41,-1.41C17.76,2.23 15.02,1 12,1zM14.86,10.01L9.14,10C8.51,10 8,10.51 8,11.14v9.71c0,0.63 0.51,1.14 1.14,1.14h5.71c0.63,0 1.14,-0.51 1.14,-1.14v-9.71c0.01,-0.63 -0.5,-1.13 -1.13,-1.13zM15,20L9,20v-8h6v8z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorSecondary"
<vector android:height="48dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M18.5,6C15.46,6 13,8.46 13,11.5c0,1.33 0.47,2.55 1.26,3.5L9.74,15c0.79,-0.95 1.26,-2.17 1.26,-3.5C11,8.46 8.54,6 5.5,6S0,8.46 0,11.5 2.46,17 5.5,17h13c3.04,0 5.5,-2.46 5.5,-5.5S21.54,6 18.5,6zM5.5,15C3.57,15 2,13.43 2,11.5S3.57,8 5.5,8 9,9.57 9,11.5 7.43,15 5.5,15zM18.5,15c-1.93,0 -3.5,-1.57 -3.5,-3.5S16.57,8 18.5,8 22,9.57 22,11.5 20.43,15 18.5,15z"/>

View File

@ -1,4 +1,4 @@
<vector android:height="48dp" android:tint="@color/colorAccent"
<vector android:height="48dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M18.5,6C15.46,6 13,8.46 13,11.5c0,1.33 0.47,2.55 1.26,3.5L9.74,15c0.79,-0.95 1.26,-2.17 1.26,-3.5C11,8.46 8.54,6 5.5,6S0,8.46 0,11.5 2.46,17 5.5,17h13c3.04,0 5.5,-2.46 5.5,-5.5S21.54,6 18.5,6zM5.5,15C3.57,15 2,13.43 2,11.5S3.57,8 5.5,8 9,9.57 9,11.5 7.43,15 5.5,15zM18.5,15c-1.93,0 -3.5,-1.57 -3.5,-3.5S16.57,8 18.5,8 22,9.57 22,11.5 20.43,15 18.5,15z"/>