code-troopers / android-betterpickers

[NO LONGER MAINTAINED] Android library for better Picker DialogFragments
2.68k stars 566 forks source link

24h time format for TimePickerBuilder() #374

Open rohnstock opened 6 years ago

rohnstock commented 6 years ago

Hello,

for the RadialTimePickerDialogFragment() is a "setForced24hFormat" method available. Is there something similar for the TimePickerBuilder() to force the 24h time format ?

cesiztel commented 5 years ago

Hi @rohnstock

I do not think that is the right desition, but what I did in my project is create my own version of TimePicker and TimePickerDialogFragment and a method like setForced24hFormat. By default, TimePicker will take the default locale to se the format. Due to you can not extend the properties, I have created my own version.

So, finally I could do something like this: final TimePickerDialogFragment dialog = TimePickerDialogFragment.newInstance(0, R.style.BetterPickersDialogFragment_Light); dialog.setForced24hMode(); dialog.setTimePickerDialogHandlers(handlers); dialog.show(fragmentManager, TimePickerDialogFragment.class.getSimpleName());

But the ideal would be fork the project and add this kind of feature to all the components.