Open curliq opened 8 years ago
At the moment, the sample app is the only source of information, other than the library code itself. There are several feature requests that are stuck in the pipeline on account of my being busy with work. Putting up a wiki page is one of them.
If there's something specific you'd like to ask, I'm happy to help.
I was actually about to ask customization but I just checked the attrs file, its really nice that you wrote all the comments! =) I'm using a SublimeTimePicker embbed in a fragment, no dialog, is there a way to get the selected time without clicking the "ok" button? Example: I have a fragment with a big button in the end, the user selects the time and a few other information and clicks the big button to send that information to another fragment, I want the user to not having to click the little "ok" button under the SublimeTimePicker, is this possible?
This is an important use-case, and also the reason why I chose to expose the pickers as Views
rather than dialogs. Unfortunately, with all the hierarchical styling (SublimePicker
--> supplies attrs to SublimeTimePicker
--> supplies attrs to RadialTimePickerView
), using individual components is not as straight-forward as I would like it to be. Here's one way of achieving this:
Under your app's theme, override the following attrs:
<style name="AppTheme" parent="BaseAppTheme">
....
....
<item name="spHeaderBackgroundPtr">?attr/colorAccent</item>
<item name="spPrimaryTextSecondaryWhenActivatedMaterialInversePtr">@color/sp_multi_use_text_light</item>
<item name="spNumbersTextColorPtr">@color/sp_text_color_primary_activated_light</item>
<item name="spNumbersInnerTextColorPtr">@color/sp_text_color_secondary_activated_light</item>
<item name="spNumbersBackgroundColorPtr">#ffdddddd</item>
<!-- For landscape layout -->
<item name="spLandscapeOkActionDrawable">@drawable/checkmark_medium_ff</item>
<item name="spLandscapeCancelActionDrawable">@drawable/cancel_medium_ff</item>
</style>
And in your fragment's xml layout:
<com.appeaser.sublimepickerlibrary.timepicker.SublimeTimePicker
android:id="@+id/time_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
When you need to get the time, use mTimePicker.getCurrentHour()
& mTimePicker.getCurrentMinute()
.
Please note that you may encounter issue #31. I am working on it.
The other problem is that you would probably be using the time-picker inside a scrolling view such as ScrollView
. RadialTimePickerView
hasn't been designed for scrolling views. Ideally, it should inspect the MotionEvent
and call requestDisallowInterceptTouchEvent(true)
to keep the scrolling view from acting on the event. With a few changes, this should be possible. However, these changes introduce another problem - when the user tries to scroll, and the ACTION_DOWN
event coordinates lie inside RadialTimePickerView
, no scrolling would occur and instead, the time will change. I can't think of a way for either of RadialTimePickerView
& scrolling view
to judge if the MotionEvent
is intended for them. One of them has to take charge.
I am open to suggestions as I would like for this implementation scenario to be possible.
Is there any sort of documentation or is the only source of information the sample?