Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Calendar] Cannot scale for tablet (sw600dp) #3659

Open
ArcherEmiya05 opened this issue Nov 2, 2023 · 0 comments
Open

[Calendar] Cannot scale for tablet (sw600dp) #3659

ArcherEmiya05 opened this issue Nov 2, 2023 · 0 comments

Comments

@ArcherEmiya05
Copy link

ArcherEmiya05 commented Nov 2, 2023

Description: Scaling Calendar dialog for tablet

Expected behavior:

Mobile
image

Tablet
image

It is actually too small in tablet (just didn't capture the whole screen) and the dialog padding has issue which can be seen when looking at the buttons

Source code: The code snippet which is causing this issue

<style name="DialogButtonStyle" parent="Widget.Material3.Button.TextButton.Dialog" tools:keep="@style/DialogButtonStyle">
        <item name="android:textSize">24sp</item>
        <item name="android:textColor">@color/colorPrimaryDark_Accent</item>
    </style>

    <!-- DatePicker theme on both light and night mode -->
    <style name="AppCalendar" parent="@style/ThemeOverlay.Material3.MaterialCalendar" tools:keep="@style/AppCalendar">
        <!-- Background color -->
        <item name="colorSurface">@color/colorWhite_Primary</item>
        <!-- Indicator or focused field color -->
        <item name="colorPrimary">@color/colorPrimary_Accent</item>
        <!-- Day color (active) -->
        <item name="colorOnPrimary">@color/colorWhite_PrimaryDark</item>
        <!-- Day color (inactive) -->
        <item name="colorOnSurface">@color/colorPrimaryDark_White</item>
        <!-- Remove unnecessary overlay -->
        <item name="elevationOverlayEnabled">false</item>
        <item name="colorOnSurfaceVariant">@color/colorPrimary_Accent</item>
        <item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyle</item>
        <item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyle</item>
        <item name="materialAlertDialogTitleTextStyle">@style/DialogTitleStyle</item>
        <item name="materialAlertDialogBodyTextStyle">@style/DialogBodyStyle</item>
        <item name="shapeAppearanceCornerExtraLarge">@style/ShapeAppearance.App.LargeComponent</item>
    </style>

    <!-- AlertDialog theme on both light and night mode -->
    <style name="AppDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog" tools:keep="@style/AppDialog">
        <!-- Background color -->
        <item name="colorSurface">@color/colorWhite_Primary</item>
        <!-- Message color -->
        <item name="colorOnSurfaceVariant">@color/colorPrimaryDark_White</item>
        <item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyle</item>
        <item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyle</item>
        <item name="alertDialogStyle">@style/MaterialAlertDialog.App</item>
        <item name="materialAlertDialogTitleTextStyle">@style/DialogTitleStyle</item>
        <item name="materialAlertDialogBodyTextStyle">@style/DialogBodyStyle</item>
    </style>

    <style name="MaterialAlertDialog.App" parent="MaterialAlertDialog.Material3" tools:keep="@style/MaterialAlertDialog_App">
        <item name="shapeAppearance">@style/ShapeAppearance.App.MediumComponent</item>
        <item name="shapeAppearanceOverlay">@null</item>
    </style>

    <!-- This may sometimes ignore when title is too long and too large that it does not fit in one line -->
    <!-- Reference: https://github.com/material-components/material-components-android/issues/3014#issue-1404665319 -->
    <style name="DialogTitleStyle" parent="@style/MaterialAlertDialog.MaterialComponents.Title.Text">
        <item name="android:textColor">@color/colorPrimaryDark_White</item>
        <item name="android:textAllCaps">true</item>
        <item name="android:textSize">40sp</item>
    </style>

    <style name="DialogBodyStyle" parent="@style/MaterialAlertDialog.MaterialComponents.Body.Text">
        <item name="android:textColor">@color/colorPrimaryDark_White</item>
        <item name="android:textSize">18sp</item>
    </style>

Here I was hoping that materialAlertDialogTitleTextStyle and materialAlertDialogBodyTextStyle will took effect just like in normal alert dialog.

I tried FullScreen version but it suffers the same issue like day.
<item name="materialCalendarDay">@style/DialogBodyStyle</item>

image

Minimal sample app repro: N/A

Android API version: 21 and above

Material Library version: 1.10.0

Device: Pixel C Emulator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants