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

[Catalog][DatePicker][TimePicker] listener is cleared after rotating device #4498

Open
manabu-nakamura opened this issue Dec 23, 2024 · 0 comments · May be fixed by #4499 or #4500
Open

[Catalog][DatePicker][TimePicker] listener is cleared after rotating device #4498

manabu-nakamura opened this issue Dec 23, 2024 · 0 comments · May be fixed by #4499 or #4500
Labels

Comments

@manabu-nakamura
Copy link
Contributor

Description: The listener is cleared after rotatinf the device.
(Case 1) Catalog app:

  1. Open a DatePicker.
    395874272-974b6dc7-044c-456c-a35b-df9430c16fbf
  2. Select any date.
  3. Press Cancel button or OK button. -> The Snackbar is shown.
    Screenshot_20241223_110026

(Case 2) Catalog app:

  1. Open a DatePicker.
  2. Rotate the device.
  3. Select any date.
  4. Press Cancel button or OK button. -> The Snackbar is NOT shown.

Expected behavior: The listener is not cleared after rotatinf the device. I think it is difficult to workaround this issue because MaterialDatePicker is final. Refine the API and/or the docs.

Source code: https://github.com/material-components/material-components-android/blob/master/catalog/java/io/material/catalog/datepicker/DatePickerMainDemoFragment.java#L164-L166

MaterialDatePicker<?> picker = builder.build();
addSnackBarListeners(picker);
picker.show(getChildFragmentManager(), picker.toString());

Minimal sample app repro: https://github.com/material-components/material-components-android/tree/master/catalog

Android API version: 35

Material Library version: 1.13.0-alpha09

Device: Emulator 35.2.10

@manabu-nakamura manabu-nakamura changed the title [Catalog][DatePicker] listener is cleared after rotating device [Catalog][DatePicker][TimePicker] listener is cleared after rotating device Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment