mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
[MaterialTimePicker] Add some defensive null checks for internal views
PiperOrigin-RevId: 390608782
This commit is contained in:
parent
10edc29b4f
commit
45f4fa0ac8
@ -305,11 +305,16 @@ public final class MaterialTimePicker extends DialogFragment {
|
||||
}
|
||||
|
||||
private void updateInputMode(MaterialButton modeButton) {
|
||||
if (modeButton == null || timePickerView == null || textInputStub == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (activePresenter != null) {
|
||||
activePresenter.hide();
|
||||
}
|
||||
|
||||
activePresenter = initializeOrRetrieveActivePresenterForMode(inputMode);
|
||||
activePresenter =
|
||||
initializeOrRetrieveActivePresenterForMode(inputMode, timePickerView, textInputStub);
|
||||
activePresenter.show();
|
||||
activePresenter.invalidate();
|
||||
Pair<Integer, Integer> buttonData = dataForMode(inputMode);
|
||||
@ -323,7 +328,8 @@ public final class MaterialTimePicker extends DialogFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private TimePickerPresenter initializeOrRetrieveActivePresenterForMode(int mode) {
|
||||
private TimePickerPresenter initializeOrRetrieveActivePresenterForMode(
|
||||
int mode, @NonNull TimePickerView timePickerView, @NonNull ViewStub textInputStub) {
|
||||
if (mode == INPUT_MODE_CLOCK) {
|
||||
timePickerClockPresenter =
|
||||
timePickerClockPresenter == null
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user