30
30
import java .util .List ;
31
31
32
32
33
+ /**
34
+ * CircleMenuView
35
+ */
33
36
public class CircleMenuView extends FrameLayout implements View .OnClickListener {
34
37
38
+ /**
39
+ * CircleMenu event listener.
40
+ */
35
41
public static class EventListener {
42
+ /**
43
+ * Invoked on menu button click, before animation start.
44
+ * @param view current CircleMenuView instance.
45
+ */
36
46
public void onMenuOpenAnimationStart (@ NonNull CircleMenuView view ) {}
47
+
48
+ /**
49
+ * Invoked on menu button click, after animation end.
50
+ * @param view - current CircleMenuView instance.
51
+ */
37
52
public void onMenuOpenAnimationEnd (@ NonNull CircleMenuView view ) {}
53
+
54
+ /**
55
+ * Invoked on close menu button click, before animation start.
56
+ * @param view - current CircleMenuView instance.
57
+ */
38
58
public void onMenuCloseAnimationStart (@ NonNull CircleMenuView view ) {}
59
+
60
+ /**
61
+ * Invoked on close menu button click, after animation end.
62
+ * @param view - current CircleMenuView instance.
63
+ */
39
64
public void onMenuCloseAnimationEnd (@ NonNull CircleMenuView view ) {}
65
+
66
+ /**
67
+ * Invoked on button click, before animation start.
68
+ * @param view - current CircleMenuView instance.
69
+ * @param buttonIndex - clicked button zero-based index.
70
+ */
40
71
public void onButtonClickAnimationStart (@ NonNull CircleMenuView view , int buttonIndex ) {}
72
+
73
+ /**
74
+ * Invoked on button click, after animation end.
75
+ * @param view - current CircleMenuView instance.
76
+ * @param buttonIndex - clicked button zero-based index.
77
+ */
41
78
public void onButtonClickAnimationEnd (@ NonNull CircleMenuView view , int buttonIndex ) {}
42
79
}
43
80
@@ -58,11 +95,6 @@ public void onButtonClickAnimationEnd(@NonNull CircleMenuView view, int buttonIn
58
95
59
96
private final List <View > mButtons = new ArrayList <>();
60
97
61
- public CircleMenuView (@ NonNull Context context ) {
62
- super (context );
63
- init (context , null , null , null );
64
- }
65
-
66
98
public CircleMenuView (@ NonNull Context context , @ Nullable AttributeSet attrs ) {
67
99
super (context , attrs );
68
100
init (context , attrs , null , null );
@@ -73,6 +105,12 @@ public CircleMenuView(@NonNull Context context, @Nullable AttributeSet attrs, @A
73
105
init (context , attrs , null , null );
74
106
}
75
107
108
+ /**
109
+ * Constructor for creation CircleMenuView in code, not in xml-layout.
110
+ * @param context current context, will be used to access resources.
111
+ * @param icons buttons icons resource ids array. Items must be @DrawableRes.
112
+ * @param colors buttons colors resource ids array. Items must be @DrawableRes.
113
+ */
76
114
public CircleMenuView (@ NonNull Context context , @ NonNull List <Integer > icons , @ NonNull List <Integer > colors ) {
77
115
super (context );
78
116
init (context , null , icons , colors );
@@ -468,43 +506,83 @@ public int getIconClose() {
468
506
return mIconClose ;
469
507
}
470
508
509
+ /**
510
+ * See {@link R.styleable#CircleMenuView_duration_close}
511
+ * @param duration close animation duration in milliseconds.
512
+ */
471
513
public void setDurationClose (int duration ) {
472
514
mDurationClose = duration ;
473
515
}
474
516
517
+ /**
518
+ * See {@link R.styleable#CircleMenuView_duration_close}
519
+ * @return current close animation duration.
520
+ */
475
521
public int getDurationClose () {
476
522
return mDurationClose ;
477
523
}
478
524
525
+ /**
526
+ * See {@link R.styleable#CircleMenuView_duration_open}
527
+ * @param duration open animation duration in milliseconds.
528
+ */
479
529
public void setDurationOpen (int duration ) {
480
530
mDurationOpen = duration ;
481
531
}
482
532
533
+ /**
534
+ * See {@link R.styleable#CircleMenuView_duration_open}
535
+ * @return current open animation duration.
536
+ */
483
537
public int getDurationOpen () {
484
538
return mDurationOpen ;
485
539
}
486
540
541
+ /**
542
+ * See {@link R.styleable#CircleMenuView_duration_ring}
543
+ * @param duration ring animation duration in milliseconds.
544
+ */
487
545
public void setDurationRing (int duration ) {
488
546
mDurationRing = duration ;
489
547
}
490
548
549
+ /**
550
+ * See {@link R.styleable#CircleMenuView_duration_ring}
551
+ * @return current ring animation duration.
552
+ */
491
553
public int getDurationRing () {
492
554
return mDurationRing ;
493
555
}
494
556
557
+ /**
558
+ * See {@link R.styleable#CircleMenuView_distance}
559
+ * @param distance in pixels.
560
+ */
495
561
public void setDistance (float distance ) {
496
562
mDistance = distance ;
497
563
invalidate ();
498
564
}
499
565
566
+ /**
567
+ * See {@link R.styleable#CircleMenuView_distance}
568
+ * @return current distance in pixels.
569
+ */
500
570
public float getDistance () {
501
571
return mDistance ;
502
572
}
503
573
504
- public void setEventListener (EventListener listener ) {
574
+ /**
575
+ * See {@link CircleMenuView.EventListener }
576
+ * @param listener new event listener or null.
577
+ */
578
+ public void setEventListener (@ Nullable EventListener listener ) {
505
579
mListener = listener ;
506
580
}
507
581
582
+ /**
583
+ * See {@link CircleMenuView.EventListener }
584
+ * @return current event listener or null.
585
+ */
508
586
public EventListener getEventListener () {
509
587
return mListener ;
510
588
}
0 commit comments