|
| 1 | +<!-- TODO: fix url --> |
| 2 | +[](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=cardslider-android-logo) |
| 3 | + |
| 4 | +# CircleMenu for Android |
| 5 | +[](http://twitter.com/Ramotion) |
| 6 | + |
| 7 | +<!-- TODO: fix urls --> |
| 8 | +[](https://www.codacy.com/app/andreylos/cardslider-android?utm_source=github.com&utm_medium=referral&utm_content=Ramotion/cardslider-android&utm_campaign=Badge_Grade) |
| 9 | +[](https://circleci.com/gh/Ramotion/cardslider-android/tree/master) |
| 10 | + |
| 11 | +## About |
| 12 | +This project is maintained by Ramotion, Inc.<br> |
| 13 | +We specialize in the designing and coding of custom UI for Mobile Apps and Websites.<br><br>**Looking for developers for your project?** |
| 14 | + |
| 15 | +<!-- TODO: fix url --> |
| 16 | +<a href="https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=cardslider-android-contact-us/#Get_in_Touch" > <img src="https://github.com/Ramotion/navigation-stack/raw/master/contact_our_team@2x.png" width="150" height="30"></a> |
| 17 | + |
| 18 | +<!-- TODO: add preview.gif --> |
| 19 | + |
| 20 | + |
| 21 | +<!-- TODO: fix url --> |
| 22 | +The [Android mockup](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=cardslider-android) available [here](https://store.ramotion.com/product/htc-one-a9-mockups?utm_source=gthb&utm_medium=special&utm_campaign=cardslider-android). |
| 23 | + |
| 24 | +## Requirements |
| 25 | + |
| 26 | +- Android 4.4 KitKat (API lvl 19) or greater |
| 27 | +- Your favorite IDE |
| 28 | + |
| 29 | +## Installation |
| 30 | + |
| 31 | +<!-- TODO: add url --> |
| 32 | +Just download the package from [here]() and add it to your project classpath, or just use the maven repo: |
| 33 | + |
| 34 | +<!-- TODO: add package --> |
| 35 | +Gradle: |
| 36 | +```groovy |
| 37 | +'com.ramotion.?' |
| 38 | +``` |
| 39 | +SBT: |
| 40 | +```scala |
| 41 | +libraryDependencies += "?" |
| 42 | +``` |
| 43 | +Maven: |
| 44 | +```xml |
| 45 | +<dependency> |
| 46 | + <groupId>com.ramotion.?</groupId> |
| 47 | + <artifactId>?</artifactId> |
| 48 | + <version>?</version> |
| 49 | +</dependency> |
| 50 | +``` |
| 51 | + |
| 52 | + |
| 53 | +## Basic usage |
| 54 | + |
| 55 | +Place the `CircleMenuView` in your layout and set the icons and colors of the buttons, as shown below. |
| 56 | +```xml |
| 57 | +app:button_colors="@array/colors" |
| 58 | +app:button_icons="@array/icons" |
| 59 | +``` |
| 60 | + |
| 61 | +Example of arrays `colors` and `icons` in `res\values\buttons.xml`: |
| 62 | +```xml |
| 63 | +<?xml version="1.0" encoding="utf-8"?> |
| 64 | +<resources> |
| 65 | + <array name="icons"> |
| 66 | + <item>@drawable/ic_home_white_24dp</item> |
| 67 | + <item>@drawable/ic_search_white_24dp</item> |
| 68 | + <item>@drawable/ic_notifications_white_24dp</item> |
| 69 | + <item>@drawable/ic_settings_white_24dp</item> |
| 70 | + <item>@drawable/ic_place_white_24dp</item> |
| 71 | + </array> |
| 72 | + <array name="colors"> |
| 73 | + <item>@android:color/holo_blue_light</item> |
| 74 | + <item>@android:color/holo_green_dark</item> |
| 75 | + <item>@android:color/holo_red_light</item> |
| 76 | + <item>@android:color/holo_purple</item> |
| 77 | + <item>@android:color/holo_orange_light</item> |
| 78 | + </array> |
| 79 | +</resources> |
| 80 | +``` |
| 81 | + |
| 82 | +Or use the constructor |
| 83 | +`CircleMenuView(@NonNull Context context, @NonNull List<Integer> icons, @NonNull List<Integer> colors)`, |
| 84 | +to add `CircleMenuView` and configure the buttons programmatically (in the code). |
| 85 | + |
| 86 | +Next, connect the event handler `CircleMenuView.EventListener` as shown below, |
| 87 | +and override the methods you need. |
| 88 | + |
| 89 | +```java |
| 90 | +final CircleMenuView menu = (CircleMenuView) findViewById(R.id.circle_menu); |
| 91 | +menu.setEventListener(new CircleMenuView.EventListener() { |
| 92 | + @Override |
| 93 | + public void onMenuOpenAnimationStart(@NonNull CircleMenuView view) { |
| 94 | + Log.d("D", "onMenuOpenAnimationStart"); |
| 95 | + } |
| 96 | + |
| 97 | + @Override |
| 98 | + public void onMenuOpenAnimationEnd(@NonNull CircleMenuView view) { |
| 99 | + Log.d("D", "onMenuOpenAnimationEnd"); |
| 100 | + } |
| 101 | + |
| 102 | + @Override |
| 103 | + public void onMenuCloseAnimationStart(@NonNull CircleMenuView view) { |
| 104 | + Log.d("D", "onMenuCloseAnimationStart"); |
| 105 | + } |
| 106 | + |
| 107 | + @Override |
| 108 | + public void onMenuCloseAnimationEnd(@NonNull CircleMenuView view) { |
| 109 | + Log.d("D", "onMenuCloseAnimationEnd"); |
| 110 | + } |
| 111 | + |
| 112 | + @Override |
| 113 | + public void onButtonClickAnimationStart(@NonNull CircleMenuView view, int index) { |
| 114 | + Log.d("D", "onButtonClickAnimationStart| index: " + index); |
| 115 | + } |
| 116 | + |
| 117 | + @Override |
| 118 | + public void onButtonClickAnimationEnd(@NonNull CircleMenuView view, int index) { |
| 119 | + Log.d("D", "onButtonClickAnimationEnd| index: " + index); |
| 120 | + } |
| 121 | +}); |
| 122 | +``` |
| 123 | + |
| 124 | +Here are the attributes you can specify through XML or related setters: |
| 125 | +*`button_icons` - Array of buttons icons. |
| 126 | +*`button_colors` - Array of buttons colors. |
| 127 | +*`icon_menu` - Menu default icon. |
| 128 | +*`icon_close` - Menu closed icon. |
| 129 | +*`icon_color` - Menu icon color. |
| 130 | +*`duration_ring` - Ring effect duration. |
| 131 | +*`duration_open` - Menu opening animation duration. |
| 132 | +*`duration_close` - Menu closing animation duration. |
| 133 | +*`distance` - Distance between center button and buttons |
| 134 | + |
| 135 | +## License |
| 136 | + |
| 137 | +CircleMenu for Android is released under the MIT license. |
| 138 | +See [LICENSE](./LICENSE.md) for details. |
| 139 | + |
| 140 | +## Follow us |
| 141 | + |
| 142 | +[](https://twitter.com/intent/tweet?text=https://github.com/Ramotion/circle-menu-android) |
| 143 | +[](https://twitter.com/ramotion) |
0 commit comments