mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
ExpirationDatePickerDF: customize buttons on onStart instead of showing dialog on onCreate
That is how DialogFragment is supposed to work Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
3148d94262
commit
8c2fc3ee87
1 changed files with 13 additions and 5 deletions
|
@ -76,6 +76,19 @@ public class ExpirationDatePickerDialogFragment
|
|||
this.onExpiryDateListener = onExpiryDateListener;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
final Dialog currentDialog = getDialog();
|
||||
if (currentDialog != null) {
|
||||
final DatePickerDialog dialog = (DatePickerDialog) currentDialog;
|
||||
dialog.getButton(DatePickerDialog.BUTTON_NEUTRAL).setTextColor(themeColorUtils.primaryColor(getContext(), true));
|
||||
dialog.getButton(DatePickerDialog.BUTTON_NEGATIVE).setTextColor(themeColorUtils.primaryColor(getContext(), true));
|
||||
dialog.getButton(DatePickerDialog.BUTTON_POSITIVE).setTextColor(themeColorUtils.primaryColor(getContext(), true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
@ -113,11 +126,6 @@ public class ExpirationDatePickerDialogFragment
|
|||
});
|
||||
}
|
||||
|
||||
dialog.show();
|
||||
dialog.getButton(DatePickerDialog.BUTTON_NEUTRAL).setTextColor(themeColorUtils.primaryColor(getContext(), true));
|
||||
dialog.getButton(DatePickerDialog.BUTTON_NEGATIVE).setTextColor(themeColorUtils.primaryColor(getContext(), true));
|
||||
dialog.getButton(DatePickerDialog.BUTTON_POSITIVE).setTextColor(themeColorUtils.primaryColor(getContext(), true));
|
||||
|
||||
// Prevent days in the past may be chosen
|
||||
DatePicker picker = dialog.getDatePicker();
|
||||
picker.setMinDate(tomorrowInMillis - 1000);
|
||||
|
|
Loading…
Reference in a new issue