|
|
Add simple circle buttons with just an image for each to BMB.
|
|
|
|
|
|
###Create BMB
|
|
|
|
|
|
Add BMB in .xml file.
|
|
|
|
|
|
```
|
|
|
<com.nightonke.boommenu.BoomMenuButton
|
|
|
android:id="@+id/bmb"
|
|
|
android:layout_width="wrap_content"
|
|
|
android:layout_height="wrap_content"
|
|
|
app:bmb_buttonEnum="simpleCircle"
|
|
|
app:bmb_piecePlaceEnum="piecePlace_dot_9_1"
|
|
|
app:bmb_buttonPlaceEnum="buttonPlace_sc_9_1"
|
|
|
/>
|
|
|
```
|
|
|
You can set button-enum, piece-place-enum and button-place-enum in .xml file with attributes or in .java file with setters. For more information and pictures about [piece-place-enum]() and [button-place-enum](), check the tables below.
|
|
|
|
|
|
###Add Builders
|
|
|
The builder of simple circle button has lots of methods to customize the boom-buttons.
|
|
|
```
|
|
|
for (int i = 0; i < bmb.getButtonPlaceEnum().buttonNumber(); i++) {
|
|
|
SimpleCircleButton.Builder builder = new SimpleCircleButton.Builder()
|
|
|
.listener(new OnBMClickListener() {
|
|
|
@Override
|
|
|
public void onBoomButtonClick(int index) {
|
|
|
// When the boom-button corresponding this builder is clicked.
|
|
|
Toast.makeText(SimpleCircleButtonActivity.this, "Clicked " + index, Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
})
|
|
|
// Whether the image-view should rotate.
|
|
|
.rotateImage(false)
|
|
|
// Whether the boom-button should have a shadow effect.
|
|
|
.shadowEffect(true)
|
|
|
// Set the horizontal shadow-offset of the boom-button.
|
|
|
.shadowOffsetX(20)
|
|
|
// Set the vertical shadow-offset of the boom-button.
|
|
|
.shadowOffsetY(0)
|
|
|
// Set the radius of shadow of the boom-button.
|
|
|
.shadowRadius(Util.dp2px(20))
|
|
|
// Set the color of the shadow of boom-button.
|
|
|
.shadowColor(Color.parseColor("#ee000000"))
|
|
|
// Set the image resource when boom-button is at normal-state.
|
|
|
.normalImageRes(R.drawable.jellyfish)
|
|
|
// Set the image drawable when boom-button is at normal-state.
|
|
|
.normalImageDrawable(getResources().getDrawable(R.drawable.jellyfish, null))
|
|
|
// Set the image resource when boom-button is at highlighted-state.
|
|
|
.highlightedImageRes(R.drawable.bat)
|
|
|
// Set the image drawable when boom-button is at highlighted-state.
|
|
|
.highlightedImageDrawable(getResources().getDrawable(R.drawable.bat, null))
|
|
|
// Set the image resource when boom-button is at unable-state.
|
|
|
.unableImageRes(R.drawable.butterfly)
|
|
|
// Set the image drawable when boom-button is at unable-state.
|
|
|
.unableImageDrawable(getResources().getDrawable(R.drawable.butterfly, null))
|
|
|
// Set the rect of image.
|
|
|
// By this method, you can set the position and size of the image-view in boom-button.
|
|
|
// For example, builder.imageRect(new Rect(0, 50, 100, 100)) will make the
|
|
|
// image-view's size to be 100 * 50 and margin-top to be 50 pixel.
|
|
|
.imageRect(new Rect(Util.dp2px(10), Util.dp2px(10), Util.dp2px(70), Util.dp2px(70)))
|
|
|
// Set the padding of image.
|
|
|
// By this method, you can control the padding in the image-view.
|
|
|
// For instance, builder.imagePadding(new Rect(10, 10, 10, 10)) will make the
|
|
|
// image-view content 10-pixel padding to itself.
|
|
|
.imagePadding(new Rect(0, 0, 0, 0))
|
|
|
// Whether the boom-button should have a ripple effect.
|
|
|
.rippleEffect(true)
|
|
|
// The color of boom-button when it is at normal-state.
|
|
|
.normalColor(Color.RED)
|
|
|
// The color of boom-button when it is at highlighted-state.
|
|
|
.highlightedColor(Color.BLUE)
|
|
|
// The color of boom-button when it is at unable-state.
|
|
|
.unableColor(Color.BLACK)
|
|
|
// Whether the boom-button is unable, default value is false.
|
|
|
.unable(false)
|
|
|
// The radius of boom-button, in pixel.
|
|
|
.buttonRadius(Util.dp2px(40));
|
|
|
bmb.addBuilder(builder);
|
|
|
}
|
|
|
```
|
|
|
Don't need to set every attributes for boom-buttons, just customize what you want. After adding builders to BMB, it is ready for a boom.
|
|
|
|
|
|
### Piece Place Enum for Simple Circle Button
|
|
|
| Number of Button | VHPiecePlaceEnum | Images |
|
|
|
| :-------- | :--------| :--------|
|
|
|
| 1 | VHPiecePlace\_DOT\_1 | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_1.png?raw=true) |
|
|
|
| 2 | VHPiecePlace\_DOT\_2\_M | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_2_1.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_2_2.png?raw=true) |
|
|
|
| 3 | VHPiecePlace\_DOT\_3\_M | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_3_1.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_3_2.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_3_3.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_3_4.png?raw=true) |
|
|
|
| 4 | VHPiecePlace\_DOT\_4\_M | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_4_1.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_4_2.png?raw=true) |
|
|
|
| 5 | VHPiecePlace\_DOT\_5\_M | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_5_1.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_5_2.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_5_3.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_5_4.png?raw=true) |
|
|
|
| 6 | VHPiecePlace\_DOT\_6\_M | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_6_1.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_6_2.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_6_3.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_6_4.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_6_5.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_6_6.png?raw=true) |
|
|
|
| 7 | VHPiecePlace\_DOT\_7\_M | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_7_1.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_7_2.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_7_3.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_7_4.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_7_5.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_7_6.png?raw=true) |
|
|
|
| 8 | VHPiecePlace\_DOT\_8\_M | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_8_1.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_8_2.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_8_3.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_8_4.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_8_5.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_8_6.png?raw=true) ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_8_7.png?raw=true) |
|
|
|
| 9 | VHPiecePlace\_DOT\_9\_M | ![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_9_1.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_9_2.png?raw=true)![](https://github.com/Nightonke/VHBoomMenuButton/blob/master/VHBoomMenuButtonPictures/DOT_9_3.png?raw=true) |
|
|
|
|
|
|
### Button Place Enum for Simple Circle Button |
|
|
\ No newline at end of file |