Skip to content
New issue

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

MaterialDesign DatePicker uses Java.Lang.Object #266

Open
DavidMarquezF opened this issue Feb 19, 2021 · 2 comments
Open

MaterialDesign DatePicker uses Java.Lang.Object #266

DavidMarquezF opened this issue Feb 19, 2021 · 2 comments
Assignees

Comments

@DavidMarquezF
Copy link

DavidMarquezF commented Feb 19, 2021

Version Information

  • Visual Studio version 16.8.5:
  • Xamarin.Android version 11.1.0.26:
  • Using AndroidX or Support Libraries: AndroidX

Describe your Issue:

MaterialDialog SetSelection, IMaterialPickerOnPositiveButtonClickListener and probably other parts of the Material dialog have Java.Lang.Object as an argument. It would be nice that it included stronger typings or even take System.DateTime.

Apparently, the original MaterialDatePicker accepts a generic. I believe the Xamarin Android Binding process doesn't handle generics very well and it has to be done by hand but I'm not sure.

https://github.com/material-components/material-components-android/blob/fb96aa859288f22fc6d0c88c28ba7826caae5175/lib/java/com/google/android/material/datepicker/MaterialDatePicker.java#L62

Steps to Reproduce (with link to sample solution if possible):

Include any relevant Exception Stack traces, build logs, adb logs:

@moljac
Copy link
Member

moljac commented Feb 23, 2021

@DavidMarquezF

It would be nice that it included stronger typings or even take System.DateTime.

It would be nice, but very often not possible due to differences between java and .net/c# worlds.

Apparently, the original MaterialDatePicker accepts a generic.

Generics are one of the biggest problems. We are trying to improve our tooling to handle such cases, but not everything is possible.

I believe the Xamarin Android Binding process doesn't handle generics very well and it has to be done by hand but I'm not sure.

Your beliefs are correct/true. Wanna help?

Checking if there is something I could do to get strongly typed arguments, but I cannot promise.

@DavidMarquezF
Copy link
Author

Would it be possible to create a wrapper? I did something similar for some bindings I'm trying to do with Afollestad Material Dialogs. I created a partial class in the Additions Folder that called the functions with the strongly typed parameters. This way you have full controll how you want to work. Then in Metadata.xml it is possible to make the not strongly typed function internal I believe (if need be)? For the sake of simplicity, instead of creating a generic class it can be done so that it supports System.DateTime only.

@jpobst jpobst removed the packages label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants