We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Description:
May 31 is not shown in the calendar unless you open May and scroll down. This causes crashes. No other month or date seems to have this problem.
Test Steps:
Actual Result: May 31 is not shown (you have to scroll down to see it) Expected Result: May 31 is shown
Here are the ways I've found to make May 31 show up without scrolling down:
Steps to make the calendar crash:
Actual Result: Crash
Expected behavior:
May 31 not shown
May 31 shown after start date has been selected
Crash Open the calendar
Select a start date before May 31
May 31 is shown because a date has been selected
Select an and date after and including May 31, so that May 31 is part of the range
Apply the filter. Open the calendar again.
Go to May using the arrows. When in April and you press the right arrow to try to go to May, the app crashes.
Crash
Source code:
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) setDatePickerBuilder() setDatePickerButton() ... } override fun onResume() { super.onResume() setDatePickerSelection() setDatePicker() .... } private fun setDatePickerBuilder() { builder = MaterialDatePicker.Builder.dateRangePicker() builder?.apply { setInputMode(MaterialDatePicker.INPUT_MODE_CALENDAR) setTitleText(getString(R.string.time_frame_ger)) val theme = resolveOrThrow(requireContext(), R.attr.materialCalendarTheme) setTheme(theme) val constraintsBuilder = CalendarConstraints.Builder() constraintsBuilder.setValidator(DateValidatorPointForward.now()) val calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")) constraintsBuilder.setStart(calendar.timeInMillis) calendar.add(Calendar.YEAR, 1) constraintsBuilder.setEnd(calendar.timeInMillis) setCalendarConstraints(constraintsBuilder.build()) setDatePickerSelection() } setDatePicker() } private fun setDatePicker() { picker = builder?.build() picker?.apply { addOnPositiveButtonClickListener { val result = it as Pair<*, *> val startDate = Date(result.first as Long) val endDate = Date(result.second as Long) experiencesViewModel.setFilterDataRange(startDate, endDate) loadExperiences(true) } addOnNegativeButtonClickListener { experiencesViewModel.resetFilterDataDateRange() loadExperiences(true) setDatePickerBuilder() } addOnDismissListener { dateButton.isEnabled = true } } } private fun setDatePickerSelection() { val filterDate = experiencesViewModel.filterData.filterDate val filterEndDate = experiencesViewModel.filterData.filterEndDate // Add an offset of 10 hours to prevent timezone daylight saving causing the calendar to show one day earlier than the selected one val dayOffset = 1000 * 60 * 60 * 10 if (filterDate != null) { if (filterEndDate == null) { val selectedDate = Date(filterDate.time + dayOffset) builder?.setSelection(Pair(selectedDate.time, selectedDate.time)) } else { builder?.setSelection(Pair(filterDate.time, filterEndDate.time)) } } } private fun setDatePickerButton() { dateButton.setOnClickListener { dateButton.isEnabled = false startDatePicker() } } private fun startDatePicker() { picker?.show(childFragmentManager, picker.toString()) }
Android API version: 27 in emulator
Material Library version: 1.2.0-alpha05
Device: Pixel 3 emulator
To help us triage faster, please check to make sure you are using the latest version of the library.
We also happily accept pull requests.
The text was updated successfully, but these errors were encountered:
I copied pretty much all your code followed thse steps and I cannot repro. Can you share a stacktrace and maybe a sample app?
Sorry, something went wrong.
@ymarian , @molundb , Can I ask you one questions?
No branches or pull requests
Description:
May 31 is not shown in the calendar unless you open May and scroll down. This causes crashes. No other month or date seems to have this problem.
Test Steps:
Actual Result: May 31 is not shown (you have to scroll down to see it)
Expected Result: May 31 is shown
Here are the ways I've found to make May 31 show up without scrolling down:
Steps to make the calendar crash:
Actual Result: Crash
Expected behavior:
May 31 not shown
May 31 shown after start date has been selected
Crash
Open the calendar
Select a start date before May 31
May 31 is shown because a date has been selected
Select an and date after and including May 31, so that May 31 is part of the range
Apply the filter. Open the calendar again.
Go to May using the arrows. When in April and you press the right arrow to try to go to May, the app crashes.
Crash
Source code:
Android API version: 27 in emulator
Material Library version: 1.2.0-alpha05
Device: Pixel 3 emulator
To help us triage faster, please check to make sure you are using the latest version of the library.
We also happily accept pull requests.
The text was updated successfully, but these errors were encountered: