Sunday, August 29, 2010

Android wheel update: event listeners

The wheel control has been updated.
There have been added next wheel event listeners:
  • OnWheelChangedListener - onChange() callback is invoked whenever current wheel position is changed
  • OnWheelScrollListener - onScrollStarts() and onScrollEnds() callbacks are invoked when wheel begins/ends being scrolling.
Also there have been updated demo activities to show how events are performed.

The time activity updates the time picker labels according to selected value. If there is chosen the "1" value the label has the singular form (hour or min), otherwise plural form is used (hours or mins).
There is also added a standard Android time picker that is synchronized with used time picker via events listeners.

The password activity has been also changed. It checks the entered PIN. Note that PIN is been not validating when one of wheel is scrolled.
The valid PIN is 2461 :)

20 comments:

  1. Hi I've had an issue with Android 1.5 emulator and posted it on your code project. I would like to ask you to check if possible where could be the problem (may be the problem is only in the emulator), and if there is anything I can do to help you solve it, because i need this control for Android 1.5 project.

    ReplyDelete
  2. Thank you Timur!
    I'll check that.

    ReplyDelete
  3. KanKan,

    I've just added a new feature in your WheelView...
    Possibility to specify the text size...
    It's just a feature that I needed :) I can sent you the class. let me know.

    ReplyDelete
  4. I added another feature : the possibility on NumericWheel to increment value by another value than 1.

    ReplyDelete
  5. Cool :)
    Could you please send me the SVN patch with your changes?

    ReplyDelete
  6. Sorry for a probably stupid question, but how to change size of the wheels?

    ReplyDelete
  7. aldoran,

    You can change wheel width by setting the android:layout_width XML attribute. Note it should be enough space to show wheel items.
    It's not recommended to set the android:layout_height to other than "wrap_content". You can change height by setting the visible items value.

    ReplyDelete
  8. Could you please describe how do i set the visible items value please

    ReplyDelete
  9. You should use WheelView.setVisibleItems().
    Please see the CitiesActivity class.

    ReplyDelete
  10. Really nice and handy component. I have used in my blog.
    http://w2davids.wordpress.com/2010/09/28/advanced-android-ui-wheelpicker/

    ReplyDelete
  11. to make it a great control miss the animation feature.
    please add

    ReplyDelete
  12. Yes, the animation is the main feature of this control.
    It will be added soon.

    ReplyDelete
  13. I have a requirement to show 2 digit numbers, i.e. 08,09,10,... This could be easily implemented in the NumericWheelAdapter. How can I submit the code to you?

    ReplyDelete
  14. Hi Dzuy65,

    Could you please create an issue on the Issue tab? Set its type to Enhancement, and provide you solution.

    Thank you

    ReplyDelete
  15. Hello. I am begginer in Android.
    Good work with Wheel widget.
    I have question. I have Data in the Listview. This is text and images data which are going together in the ListView. The data is stored This data is stored in ArrayList and binded with ListView through SpecialAdapter.
    The problem is how to put array data of text and images into Wheel view?
    WheelView is accepting simple strings. So Do I need to rewrite ArrayWheelAdapter to make it work with SpecialAdapter? Or I need Rewrite Special adapter according ArrayWheelAdapter?
    Thank you.

    ReplyDelete
  16. Great work!
    I was looking for something like that, one thing though would be nice have on the Time Activity is one more wheel bind to the calendar (Sat 22 Jan , Sun 23 Jan...).

    Thanks anyway for the great widget

    ReplyDelete
  17. Sergey,
    At now it is impossible to use images in WheelView. This feature is in progress now, please wait for few days.
    In any case you will have to create your custom adapter to use more than just TextView items.
    If you have already SpecialAdapter you can just delegate wheel view adapter methods to SpecialAdapter ones.

    ReplyDelete
  18. Marco,

    Thank you for the idea!
    Actually it is already done in scope of custom item views implementation, and will be available soon :)

    ReplyDelete
  19. Kankan,

    That would be great! The wheel I had in mind is something like that http://i.min.us/iekgNM.png which merge together date and time in one widget.

    Great job!

    ReplyDelete
  20. hi All,
    i am new to android. is there any chance to change the position of wheel from center to left?
    Thank you

    ReplyDelete