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

RadialTimePickerDialogFragment AM/PM #243

Closed
paxxux opened this issue Jan 25, 2016 · 8 comments
Closed

RadialTimePickerDialogFragment AM/PM #243

paxxux opened this issue Jan 25, 2016 · 8 comments

Comments

@paxxux
Copy link
Contributor

paxxux commented Jan 25, 2016

Hi,

The RadialTimePickerDialogFragment does not change to AM/PM if I set my device to non 24-Hour format.

It would be easy to verify, if the device is in 24-Hour mode or not:
boolean b = DateFormat.is24HourFormat(context);

I would suggest to fall back on the device time format, rather than setting it (mIs24HourMode = true;) to a default value.

I cannot see any possibility to override mIs24HourMode in RadialTimePickerDialogFragment.

Or do I just miss something?

Greetings,
paxxux

@paxxux paxxux changed the title TimePicker AM/PM RadialTimePickerDialogFragment AM/PM Jan 25, 2016
@fchauveau
Copy link
Member

Hello @paxxux

Indeed we actually do not correctly preset 24h-dateFormat
For now you can (must) set this param, (using is24HourFormat as you suggest) by calling

RadialTimePickerDialogFragment#initialize(OnTimeSetListener callback, int hourOfDay, int minute, boolean is24HourMode)

We will soon release a new version with a better management of 24h-format,
thx

@paxxux
Copy link
Contributor Author

paxxux commented Jan 25, 2016

Great! Thank you!

@fchauveau
Copy link
Member

Hi @paxxux
v2.4.0 have been release, you can now force detection on dateFormat using

RadialTimePickerDialogFragment.setAutodetectDateFormat(Context);

@paxxux
Copy link
Contributor Author

paxxux commented Jan 27, 2016

Hi,

Thanks for the hint! Works great!

  1. I would suggest to auto-detect by default. In my opinion people want a picker according to user preferences, rather than 24-hour format. It would make one's code more simple and your users do not have to search your API for auto-detection. I believe force 12/24-hour is a rarer use case.

  RadialTimePickerDialogFragment.setAutodetectDateFormat(Context);

Why don't you use DialogFragment.getContext() instead of taking a Context argument? I am not really sure, but is there a case of more than one Context in one app?

@paxxux paxxux reopened this Jan 27, 2016
@fchauveau
Copy link
Member

1/ I didn't set it by default because I was waiting for Context
2/ And I didn't tried to get context by myself.

But you are right DialogFragment.getContext() solve all of this.
So I'm going to autodetect by default using DialogFragment.getContext \o/

Thank you

@paxxux
Copy link
Contributor Author

paxxux commented Jan 27, 2016

Thank you too :-)

@fchauveau
Copy link
Member

@paxxux
Correction is available in version 2.5.0 just released

@paxxux
Copy link
Contributor Author

paxxux commented Feb 2, 2016

Great :) just updated. Works fine!

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

2 participants