Material 3 theme and color support, filled cards

This commit is contained in:
Adam Kasprzycki 2022-10-16 00:10:00 +02:00 committed by Kuba Szczodrzyński
parent fadf1d7754
commit af75049ac7
6 changed files with 126 additions and 29 deletions

View File

@ -93,21 +93,21 @@ class HomeTimetableCard(
b.settings.setImageDrawable( b.settings.setImageDrawable(
IconicsDrawable(activity, CommunityMaterial.Icon.cmd_cog_outline).apply { IconicsDrawable(activity, CommunityMaterial.Icon.cmd_cog_outline).apply {
colorAttr(activity, R.attr.colorIcon) colorAttr(activity, R.attr.colorOnPrimaryContainer)
sizeDp = 24 sizeDp = 24
} }
) )
b.bellSync.setImageDrawable( b.bellSync.setImageDrawable(
IconicsDrawable(activity, SzkolnyFont.Icon.szf_alarm_bell_outline).apply { IconicsDrawable(activity, SzkolnyFont.Icon.szf_alarm_bell_outline).apply {
colorAttr(activity, R.attr.colorIcon) colorAttr(activity, R.attr.colorOnPrimaryContainer)
sizeDp = 24 sizeDp = 24
} }
) )
b.showCounter.setImageDrawable( b.showCounter.setImageDrawable(
IconicsDrawable(activity, CommunityMaterial.Icon2.cmd_fullscreen).apply { IconicsDrawable(activity, CommunityMaterial.Icon2.cmd_fullscreen).apply {
colorAttr(activity, R.attr.colorIcon) colorAttr(activity, R.attr.colorOnPrimaryContainer)
sizeDp = 24 sizeDp = 24
} }
) )

View File

@ -9,4 +9,6 @@
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginVertical="8dp" android:layout_marginVertical="8dp"
android:clickable="true" android:clickable="true"
android:focusable="true" /> android:focusable="true"
android:background="?colorSurfaceVariant"
style="?attr/materialCardViewFilledStyle" />

View File

@ -24,7 +24,7 @@
agendaCalendar:calendarHeaderColor="@color/colorSurface_6dp" agendaCalendar:calendarHeaderColor="@color/colorSurface_6dp"
agendaCalendar:calendarHeaderTextColor="?colorOnSurface" agendaCalendar:calendarHeaderTextColor="?colorOnSurface"
agendaCalendar:calendarPastDayTextColor="?android:textColorSecondary" agendaCalendar:calendarPastDayTextColor="?android:textColorSecondary"
agendaCalendar:fabColor="?colorFab" agendaCalendar:fabColor="?colorPrimaryContainer"
agendaCalendar:layout_constraintBottom_toBottomOf="parent" agendaCalendar:layout_constraintBottom_toBottomOf="parent"
agendaCalendar:layout_constraintEnd_toEndOf="parent" agendaCalendar:layout_constraintEnd_toEndOf="parent"
agendaCalendar:layout_constraintHorizontal_bias="1.0" agendaCalendar:layout_constraintHorizontal_bias="1.0"

View File

@ -5,5 +5,5 @@
<attr name="timetable_lesson_change_color" format="color" /> <attr name="timetable_lesson_change_color" format="color" />
<attr name="timetable_lesson_shifted_source_color" format="color" /> <attr name="timetable_lesson_shifted_source_color" format="color" />
<attr name="timetable_lesson_shifted_target_color" format="color" /> <attr name="timetable_lesson_shifted_target_color" format="color" />
<attr name="colorIcon" format="color" /> <attr name="colorOnPrimaryContainer" format="color" />
</resources> </resources>

View File

@ -1,5 +1,70 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Material 3 theme builder light colors -->
<color name="seed">#2196f3</color>
<color name="md_theme_light_primary">#0061A4</color>
<color name="md_theme_light_onPrimary">#FFFFFF</color>
<color name="md_theme_light_primaryContainer">#D1E4FF</color>
<color name="md_theme_light_onPrimaryContainer">#001D36</color>
<color name="md_theme_light_secondary">#535F70</color>
<color name="md_theme_light_onSecondary">#FFFFFF</color>
<color name="md_theme_light_secondaryContainer">#D7E3F7</color>
<color name="md_theme_light_onSecondaryContainer">#101C2B</color>
<color name="md_theme_light_tertiary">#6B5778</color>
<color name="md_theme_light_onTertiary">#FFFFFF</color>
<color name="md_theme_light_tertiaryContainer">#F2DAFF</color>
<color name="md_theme_light_onTertiaryContainer">#251431</color>
<color name="md_theme_light_error">#BA1A1A</color>
<color name="md_theme_light_errorContainer">#FFDAD6</color>
<color name="md_theme_light_onError">#FFFFFF</color>
<color name="md_theme_light_onErrorContainer">#410002</color>
<color name="md_theme_light_background">#FDFCFF</color>
<color name="md_theme_light_onBackground">#1A1C1E</color>
<color name="md_theme_light_surface">#FDFCFF</color>
<color name="md_theme_light_onSurface">#1A1C1E</color>
<color name="md_theme_light_surfaceVariant">#DFE2EB</color>
<color name="md_theme_light_onSurfaceVariant">#43474E</color>
<color name="md_theme_light_outline">#73777F</color>
<color name="md_theme_light_inverseOnSurface">#F1F0F4</color>
<color name="md_theme_light_inverseSurface">#2F3033</color>
<color name="md_theme_light_inversePrimary">#9ECAFF</color>
<color name="md_theme_light_shadow">#000000</color>
<color name="md_theme_light_surfaceTint">#0061A4</color>
<color name="md_theme_light_surfaceTintColor">#0061A4</color>
<!-- Material 3 theme builder dark colors -->
<color name="md_theme_dark_primary">#9ECAFF</color>
<color name="md_theme_dark_onPrimary">#003258</color>
<color name="md_theme_dark_primaryContainer">#00497D</color>
<color name="md_theme_dark_onPrimaryContainer">#D1E4FF</color>
<color name="md_theme_dark_secondary">#BBC7DB</color>
<color name="md_theme_dark_onSecondary">#253140</color>
<color name="md_theme_dark_secondaryContainer">#3B4858</color>
<color name="md_theme_dark_onSecondaryContainer">#D7E3F7</color>
<color name="md_theme_dark_tertiary">#D6BEE4</color>
<color name="md_theme_dark_onTertiary">#3B2948</color>
<color name="md_theme_dark_tertiaryContainer">#523F5F</color>
<color name="md_theme_dark_onTertiaryContainer">#F2DAFF</color>
<color name="md_theme_dark_error">#FFB4AB</color>
<color name="md_theme_dark_errorContainer">#93000A</color>
<color name="md_theme_dark_onError">#690005</color>
<color name="md_theme_dark_onErrorContainer">#FFDAD6</color>
<color name="md_theme_dark_background">#1A1C1E</color>
<color name="md_theme_dark_onBackground">#E2E2E6</color>
<color name="md_theme_dark_surface">#1A1C1E</color>
<color name="md_theme_dark_onSurface">#E2E2E6</color>
<color name="md_theme_dark_surfaceVariant">#43474E</color>
<color name="md_theme_dark_onSurfaceVariant">#C3C7CF</color>
<color name="md_theme_dark_outline">#8D9199</color>
<color name="md_theme_dark_inverseOnSurface">#1A1C1E</color>
<color name="md_theme_dark_inverseSurface">#E2E2E6</color>
<color name="md_theme_dark_inversePrimary">#0061A4</color>
<color name="md_theme_dark_shadow">#000000</color>
<color name="md_theme_dark_surfaceTint">#9ECAFF</color>
<color name="md_theme_dark_surfaceTintColor">#9ECAFF</color>
<color name="colorPrimary">#2196F3</color> <color name="colorPrimary">#2196F3</color>
<color name="colorPrimaryDark">#1976D2</color> <color name="colorPrimaryDark">#1976D2</color>
<color name="colorPrimaryLight">#6EC6FF</color> <color name="colorPrimaryLight">#6EC6FF</color>

View File

@ -98,20 +98,35 @@
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme.Light" parent="NavView.Light"> <style name="AppTheme.Light" parent="NavView.Light">
<item name="colorPrimary">#2196f3</item> <item name="colorPrimary">@color/md_theme_light_primary</item>
<item name="colorOnPrimary">@color/md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/md_theme_light_onPrimaryContainer</item>
<item name="colorSecondary">@color/md_theme_light_secondary</item>
<item name="colorOnSecondary">@color/md_theme_light_onSecondary</item>
<item name="colorSecondaryContainer">@color/md_theme_light_secondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/md_theme_light_onSecondaryContainer</item>
<item name="colorTertiary">@color/md_theme_light_tertiary</item>
<item name="colorOnTertiary">@color/md_theme_light_onTertiary</item>
<item name="colorTertiaryContainer">@color/md_theme_light_tertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/md_theme_light_onTertiaryContainer</item>
<item name="colorError">@color/md_theme_light_error</item>
<item name="colorErrorContainer">@color/md_theme_light_errorContainer</item>
<item name="colorOnError">@color/md_theme_light_onError</item>
<item name="colorOnErrorContainer">@color/md_theme_light_onErrorContainer</item>
<item name="android:colorBackground">@color/md_theme_light_background</item>
<item name="colorOnBackground">@color/md_theme_light_onBackground</item>
<item name="colorSurface">@color/md_theme_light_surface</item>
<item name="colorOnSurface">@color/md_theme_light_onSurface</item>
<item name="colorSurfaceVariant">@color/md_theme_light_surfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/md_theme_light_onSurfaceVariant</item>
<item name="colorOutline">@color/md_theme_light_outline</item>
<item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_light_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_light_inversePrimary</item>
<item name="colorPrimaryDark">#1976d2</item> <item name="colorPrimaryDark">#1976d2</item>
<item name="colorPrimaryVariant">#2196f3</item>
<item name="colorAccent">#ff3d00</item> <item name="colorAccent">#ff3d00</item>
<item name="colorFab">#4CAF50</item>
<item name="colorFabIcon">#c8e6c9</item>
<item name="colorOnFab">#ffffff</item>
<item name="colorIcon">#8a000000</item>
<item name="mal_color_primary">?android:textColorPrimary</item>
<item name="mal_color_secondary">?android:textColorSecondary</item>
<item name="mal_card_background">?colorSurface</item>
<item name="timetable_lesson_bg">@drawable/timetable_lesson_bg_light</item> <item name="timetable_lesson_bg">@drawable/timetable_lesson_bg_light</item>
<item name="timetable_lesson_cancelled_color">#9f9f9f</item> <item name="timetable_lesson_cancelled_color">#9f9f9f</item>
<item name="timetable_lesson_change_color">#ffb300</item> <item name="timetable_lesson_change_color">#ffb300</item>
@ -123,19 +138,34 @@
<item name="materialAlertDialogTheme">@style/AppTheme.MaterialAlertDialog</item> <item name="materialAlertDialogTheme">@style/AppTheme.MaterialAlertDialog</item>
</style> </style>
<style name="AppTheme.Dark" parent="NavView.Dark"> <style name="AppTheme.Dark" parent="NavView.Dark">
<item name="colorPrimary">#64b5f6</item> <item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/md_theme_dark_onPrimaryContainer</item>
<item name="colorSecondary">@color/md_theme_dark_secondary</item>
<item name="colorOnSecondary">@color/md_theme_dark_onSecondary</item>
<item name="colorSecondaryContainer">@color/md_theme_dark_secondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/md_theme_dark_onSecondaryContainer</item>
<item name="colorTertiary">@color/md_theme_dark_tertiary</item>
<item name="colorOnTertiary">@color/md_theme_dark_onTertiary</item>
<item name="colorTertiaryContainer">@color/md_theme_dark_tertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/md_theme_dark_onTertiaryContainer</item>
<item name="colorError">@color/md_theme_dark_error</item>
<item name="colorErrorContainer">@color/md_theme_dark_errorContainer</item>
<item name="colorOnError">@color/md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/md_theme_dark_background</item>
<item name="colorOnBackground">@color/md_theme_dark_onBackground</item>
<item name="colorSurface">@color/md_theme_dark_surface</item>
<item name="colorOnSurface">@color/md_theme_dark_onSurface</item>
<item name="colorSurfaceVariant">@color/md_theme_dark_surfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/md_theme_dark_onSurfaceVariant</item>
<item name="colorOutline">@color/md_theme_dark_outline</item>
<item name="colorOnSurfaceInverse">@color/md_theme_dark_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_dark_inverseSurface</item>
<item name="colorPrimaryInverse">@color/md_theme_dark_inversePrimary</item>
<item name="colorPrimaryDark">#1976d2</item> <item name="colorPrimaryDark">#1976d2</item>
<item name="colorPrimaryVariant">#2196f3</item> <item name="colorAccent">#ff3d00</item>
<item name="colorAccent">#ffb300</item>
<item name="colorFab">#4CAF50</item>
<item name="colorFabIcon">#c8e6c9</item>
<item name="colorOnFab">#ffffff</item>
<item name="colorIcon">#b4ffffff</item>
<item name="mal_color_primary">@color/primaryTextDark</item>
<item name="mal_color_secondary">@color/secondaryTextDark</item>
<item name="mal_card_background">?colorSurface</item>
<item name="timetable_lesson_bg">@drawable/timetable_lesson_bg_dark</item> <item name="timetable_lesson_bg">@drawable/timetable_lesson_bg_dark</item>
<item name="timetable_lesson_cancelled_color">#838383</item> <item name="timetable_lesson_cancelled_color">#838383</item>