dbankier / TiDialogs

Titanium native module for the the missing Android dialogs.
MIT License
75 stars 21 forks source link

Hide specific date selector #8

Open filaruina opened 9 years ago

filaruina commented 9 years ago

Hi,

Is it possible to hide one of the selectors in the date time selector? I've seen some code apparently doing that in native android: http://stackoverflow.com/questions/21321789/android-datepicker-change-to-only-month-and-year There is a cool one-liner ((ViewGroup) datePickerDialog.getDatePicker()).findViewById(Resources.getSystem().getIdentifier("day", "id", "android")).setVisibility(View.GONE); I wanted to test it but I didn't manage to compile the module on my machine.

Thanks for any help

dbankier commented 9 years ago

Been away from this module for a bit but sounds like a good idea. It's on the to do list.

filaruina commented 9 years ago

Great! I managed to do it here, but I did the options specific for our use case. Anyway, this worked

((ViewGroup) picker.getDatePicker()).findViewById(
    Resources.getSystem().getIdentifier("year", "id", "android")
).setVisibility(View.GONE);

It also works with "month" and "day". I'll try to organize the code a bit better and will make a pull request