Android-Wheel-Menu


Source link: https://github.com/anupcowkur/Android-Wheel-Menu

Deprecated

This library is no longer maintained. It will work fine but no new issues, feature requests etc will be accepted. You can still use the source as reference to make your own custom views.

Android Wheel Menu

Usage

First download the jar and add it to your project. The exact instructions to include the jar will depend on your specific development environment, IDE etc. You can also add wheel-menu-library as a library project and reference it directly without adding the jar.

Include wheel menu in your layout:

<com.anupcowkur.wheelmenu.WheelMenu android:id="@+id/wheelMenu" android:layout_width="300dp" android:layout_height="300dp" />

Initialize the wheel menu in your activity:

wheelMenu = (WheelMenu) findViewById(R.id.wheelMenu);
  //set the no of divisions in the wheel, default is 1 wheelMenu.setDivCount(12);
  //set the drawable to be used as the wheel image. If you //don't set this, you'll get a  NullPointerException. wheelMenu.setWheelImage(R.drawable.wheel);

That's it!

Now, to get the currently selected position simply call:

wheelMenu.getSelectedPosition();

or, you can set a listener to monitor change events like so:

wheelMenu.setWheelChangeListener(new WheelMenu.WheelChangeListener() {
 @Override public void onSelectionChange(int selectedPosition) {

 //do your thing
  
}
 
}
);

wheel positions will start from 0.

####snap-to-center

This flag is set to true by default. If true, crossing into a division will cause the wheel to auto-align itself to the center of the division. Otherwise, the wheel will just hang around wherever the user left it. You can change it by calling:

wheelMenu.setSnapToCenterFlag(false)

####Changing the top position

You can also make any arbitrary div in the wheel to be the "top" postion by calling

wheelMenu.setAlternateTopDiv(int);

For instance, if you call wheelMenu.setAlternateTopDiv(6) then the sixth div will now be considered as the "top" and all calculations from that point on will reflect this. This can be useful in situations such as when you want the bottom div or right div of the wheel to be the selected position.

A caveat with this is that you have to call this method after the call to setDivCount(int) . If you call it before, then your new top position will be ignored and the top will still be 0.

Sample

Check out the sample application to see it in action!

Contributing

Contributions welcome via Github pull requests.

License

This project is licensed under the MIT License. Please refer the License.txt file.

Resources

A simple cool dismissal animation for activities.

Star DNS Changer is a DNS Changer application.

A plugin for Kotlin generate Kotlin data class code from a json string.

A simple cool text carousel for Android.

A sample app that shows how we can apply unidirectional data flow architecture on Android using Kotlin.

Kotlin-AgendaCalendarView is a calendar widget with list of events which can be dynamically filled.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes