|
35 | 35 | */
|
36 | 36 | public class CircleMenuView extends FrameLayout implements View.OnClickListener {
|
37 | 37 |
|
38 |
| - private static int DEFAULT_BUTTON_SIZE = 56; |
39 |
| - private static float DEFAULT_DISTANCE = DEFAULT_BUTTON_SIZE * 1.5f; |
40 |
| - private static float DEFAULT_RING_SCALE_RATIO = 1.3f; |
| 38 | + private static final int DEFAULT_BUTTON_SIZE = 56; |
| 39 | + private static final float DEFAULT_DISTANCE = DEFAULT_BUTTON_SIZE * 1.5f; |
| 40 | + private static final float DEFAULT_RING_SCALE_RATIO = 1.3f; |
41 | 41 |
|
42 | 42 | /**
|
43 | 43 | * CircleMenu event listener.
|
@@ -127,7 +127,6 @@ public CircleMenuView(@NonNull Context context, @NonNull List<Integer> icons, @N
|
127 | 127 | private void init(@NonNull Context context, @Nullable AttributeSet attrs,
|
128 | 128 | @Nullable List<Integer> icons, @Nullable List<Integer> colors)
|
129 | 129 | {
|
130 |
| - // TODO: add setter |
131 | 130 | final int menuButtonColor;
|
132 | 131 |
|
133 | 132 | final float density = context.getResources().getDisplayMetrics().density;
|
@@ -339,7 +338,11 @@ public void onAnimationEnd(Animator animation) {
|
339 | 338 | mRingView.setVisibility(View.INVISIBLE);
|
340 | 339 | mRingView.setStartAngle(startAngle);
|
341 | 340 | mRingView.setAngle(0);
|
342 |
| - mRingView.setStrokeColor(button.getBackgroundTintList().getDefaultColor()); |
| 341 | + |
| 342 | + final ColorStateList csl = button.getBackgroundTintList(); |
| 343 | + if (csl != null) { |
| 344 | + mRingView.setStrokeColor(csl.getDefaultColor()); |
| 345 | + } |
343 | 346 |
|
344 | 347 | final ObjectAnimator ring = ObjectAnimator.ofFloat(mRingView, "angle", 360);
|
345 | 348 | final ObjectAnimator scaleX = ObjectAnimator.ofFloat(mRingView, "scaleX", 1f, DEFAULT_RING_SCALE_RATIO);
|
|
0 commit comments