techyourchance / TechYourChance-Android-Application

This app demonstrates the best practices for Android development and contains a repository of tutorials, benchmarks and reference implementations
https://techyourchance.com
GNU General Public License v3.0
287 stars 28 forks source link

Migrate to Material 3 Theme #3

Closed dautovicharis closed 11 months ago

dautovicharis commented 11 months ago

Hi Vasiliy, I have a suggestion to improve the app by migrating to Material 3 themes. This way, we can keep the styles consistent and easy to customize, following the Material 3 guidelines. It would also help fix any dark mode issues (https://github.com/techyourchance/TechYourChance-Android-Application/issues/1) and allow better support for multiple themes.

If you agree with this suggestion, I can create a pull request tomorrow.

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
        <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="colorOnError">@color/md_theme_light_onError</item>
        <item name="colorErrorContainer">@color/md_theme_light_errorContainer</item>
        <item name="colorOnErrorContainer">@color/md_theme_light_onErrorContainer</item>
        <item name="colorOutline">@color/md_theme_light_outline</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="colorSurfaceInverse">@color/md_theme_light_inverseSurface</item>
        <item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface</item>
        <item name="colorPrimaryInverse">@color/md_theme_light_inversePrimary</item>

        <!-- Default styles -->
        <item name="materialButtonStyle">@style/Button.Default</item>
        <item name="android:textViewStyle">@style/BodyLarge.TextViewStandard</item>
        <item name="editTextStyle">@style/EditText.Default</item>
        <item name="checkboxStyle">@style/CheckBox.Default</item>
        <item name="radioButtonStyle">@style/RadioButton.Default</item>
        <item name="switchStyle">@style/Switch.Default</item>
        <item name="progressBarStyle">@style/ProgressBar.Default</item>
    </style>

</resources>


- Styles appearance

<?xml version="1.0" encoding="utf-8"?>


- Styles dialog....
**We can create a new style for specific screens if we want to override default style**.

<?xml version="1.0" encoding="utf-8"?>


- Styles widget

<?xml version="1.0" encoding="utf-8"?>