Skip to content

Conversation

@manabu-nakamura
Copy link
Contributor

close #4498

@drchen drchen requested a review from paulfthomas January 2, 2025 18:41
@paulfthomas
Copy link
Member

I don't think this fix works as intended, I don't see an issue with the click listener being lost on rotation. The only potential issue I see is the time being reset after rotation.

@manabu-nakamura
Copy link
Contributor Author

#4498

(Case 1) Catalog app:

  1. Open a TimePicker.
    Screenshot_20250108_092527
  2. Select any time.
    Screenshot_20250108_092550
  3. Press OK button. -> The time is updated.
    Screenshot_20250108_092602

(Case 2) Catalog app:

  1. Open a TimePicker.
  2. Rotate the device.
  3. Select any time.
    Screenshot_20250108_092649
  4. Press OK button. -> The time is NOT updated.
    Screenshot_20250108_092703

https://github.com/material-components/material-components-android/blob/master/catalog/java/io/material/catalog/timepicker/TimePickerMainDemoFragment.java#L126-L133:

MaterialTimePicker materialTimePicker = materialTimePickerBuilder.build();
materialTimePicker.show(requireFragmentManager(), "fragment_tag");

materialTimePicker.addOnPositiveButtonClickListener(dialog -> {
  int newHour = materialTimePicker.getHour();
  int newMinute = materialTimePicker.getMinute();
  TimePickerMainDemoFragment.this.onTimeSet(newHour, newMinute);
});

@paulfthomas paulfthomas added the Reviewing Internally An internal change has been created and sent for review. label Jan 15, 2025
@pekingme pekingme closed this in 6a7c034 Jan 16, 2025
@manabu-nakamura manabu-nakamura deleted the timepicker branch January 17, 2025 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewing Internally An internal change has been created and sent for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants