philliphsu / BottomSheetPickers

Third-party date and time pickers for Android.
Apache License 2.0
1.1k stars 140 forks source link

Customisable bottom-left button? #26

Open jackunderwood93 opened 7 years ago

jackunderwood93 commented 7 years ago

Hi Phillip,

Any chance if you implementing a customisable button for the bottom-left of the Number Pad? I'd love to use it as a All-Day button in the calendar app I'm building, so ideally I'd prefer it if text or a icon can be placed there.

Would submit a pull request for it but am unsure of if/how you'd want it implemented.

philliphsu commented 7 years ago

I think the need for such a button is application specific, and not general enough to be offered in the library. i.e. is an extra button in the time picker a convenience that solves a common enough problem for developers?

You're welcome to make a fork and implement this however you wish. Or you can take the relevant source code and modify it as needed for your app. Let me know if you have any questions.

Lx commented 6 years ago

@jackunderwood93, this particular button is known as the “neutral button” in the Android framework.

@philliphsu, a third button has existed on AlertDialogs (and therefore Android date and time picker dialogs) since the very first version of Android. Please consider changing your position on this issue.

philliphsu commented 6 years ago

@Lx Late response, but I thought I'd try addressing this anyway. Unfortunately, I'm hesitant to add new features in this library. I made some novice design decisions on top of legacy AOSP code in the making of this library. In hindsight, the design of the existing AOSP code was not SOLID. As such, I feel the current state of the codebase cannot facilitate the addition of new features such as neutral buttons and the client APIs required for them.

However, I released a new library called NumberPadTimePicker about six months ago which offers the same number pad time picker as in this library, but it was completely rewritten to be much more SOLID. As such, I consider this library's implementation of the number pad time picker to be deprecated. The widget is provided as a standalone View instead of coupled to a DialogFragment as in this library. This gives you more flexibility in use cases, because now you can add the widget to your own layouts and customize it as you wish. So if you would like to add a neutral button to the number pad, perhaps you can inflate an instance of NumberPadTimePicker inside of a standard Android AlertDialog and set the neutral button there.

@jackunderwood93 You may have implemented your own solution already, but take a look at this library in the future.

https://github.com/philliphsu/NumberPadTimePicker