wdullaer / MaterialDateTimePicker

Pick a date or time on Android in style
Apache License 2.0
4.67k stars 949 forks source link

Can it be an independent view class? #209

Open NeoLSN opened 8 years ago

NeoLSN commented 8 years ago

Can they be independent view classes like DatePicker or TimePicker so they can be apply in activity or fragment not only in a dialog?

wdullaer commented 8 years ago

They are DialogFragments, which is a class that extends Fragment So technically they should be usable in an Activity. That being said, I never tested this. Let me know how it goes :-)

NeoLSN commented 8 years ago

If you use a DialogFragment in activity layout, it will jump out a dialog after activity created. What I want is to use a View class in the layout.

wdullaer commented 8 years ago

In that case it's not supported right now. I don't have a lot of time to work on this at the moment, and still a lot of things that are higher up on the priority list. You'll find most of the components you want in separate classes. If you can manage to integrate it in a transparent matter to the current functionality, I'm more than happy to take a pull request :-)

chylek commented 7 years ago

I have successfully embedded the TimePickerDialog into Activity, just like it says in DialogFragment documentation. In the Activity's layout there is a view with id embedded. Only the OnTimeSetListener is useless, you have to check the time manually with getSelectedTime() Is this not the behaviour you wanted?

FragmentTransaction ft = getFragmentManager().beginTransaction();
DialogFragment newFragment = TimePickerDialog.newInstance(null, 0, 0, 0, true);
ft.add(R.id.embedded, newFragment);
ft.commit();

tmp