Skip to content

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

Closed
@manabu-nakamura

Description

@manabu-nakamura

Description: The listener is cleared after rotatinf the device (#1688).
DatePicker:
(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.

TimePicker:
#4500

Expected behavior: The listener is not cleared after rotatinf the device. I think it is difficult to workaround this issue. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions