library/src/main/java/com/oguzdev/circularfloatingactionmenu/library/FloatingActionMenu.java
private Point calculateItemPositions() {
        // Create an arc that starts from startAngle and ends at endAngle
        // in an area that is as large as 4*radius^2
        final Point center = getActionViewCenter();
        RectF area = new RectF(center.x - radius, center.y - radius, center.x + radius, center.y + radius);

        Path orbit = new Path();
        orbit.addArc(area, startAngle, endAngle - startAngle);

        PathMeasure measure = new PathMeasure(orbit, false);

        // Prevent overlapping when it is a full circle
        int divisor;
        if(Math.abs(endAngle - startAngle) >= 360 || subActionItems.size() <= 1) {
            divisor = subActionItems.size();
        }
        else {
            divisor = subActionItems.size() -1;
        }

        // Measure this path, in order to find points that have the same distance between each other
        for(int i=0; i<subActionItems.size(); i++) {
            float[] coords = new float[] {0f, 0f};
            measure.getPosTan((i) * measure.getLength() / divisor, coords, null);
            // get the x and y values of these points and set them to each of sub action items.
            subActionItems.get(i).x = (int) coords[0] - subActionItems.get(i).width / 2;
            subActionItems.get(i).y = (int) coords[1] - subActionItems.get(i).height / 2;
        }
        return center;
    }
private Point calculateItemPositions() {
        // Create an arc that starts from startAngle and ends at endAngle
        // in an area that is as large as 4*radius^2
        final Point center = getActionViewCenter();
        RectF area = new RectF(center.x - radius, center.y - radius, center.x + radius, center.y + radius);

        Path orbit = new Path();
        orbit.addArc(area, startAngle, endAngle - startAngle);

        PathMeasure measure = new PathMeasure(orbit, false);

        // Prevent overlapping when it is a full circle
        int divisor;
        if(Math.abs(endAngle - startAngle) >= 360 || subActionItems.size() <= 1) {
            divisor = subActionItems.size();
        }
        else {
            divisor = subActionItems.size() -1;
        }

        // Measure this path, in order to find points that have the same distance between each other
        for(int i=0; i<subActionItems.size(); i++) {
            float[] coords = new float[] {0f, 0f};
            measure.getPosTan((i) * measure.getLength() / divisor, coords, null);
            // get the x and y values of these points and set them to each of sub action items.
            subActionItems.get(i).x = (int) coords[0] - subActionItems.get(i).width / 2;
            subActionItems.get(i).y = (int) coords[1] - subActionItems.get(i).height / 2;
        }
        return center;
    }
private Point calculateItemPositions ( ) { // Create an arc that starts from startAngle and ends at endAngle // in an area that is as large as 4*radius^2 final Point center = getActionViewCenter ( ) ; RectF area = new RectF ( center . x - radius , center . y - radius , center . x + radius , center . y + radius ) ; Path orbit = new Path ( ) ; orbit . addArc ( area , startAngle , endAngle - startAngle ) ; PathMeasure measure = new PathMeasure ( orbit , false ) ; // Prevent overlapping when it is a full circle int divisor ; if ( Math . abs ( endAngle - startAngle ) >= 360 || subActionItems . size ( ) <= 1 ) { divisor = subActionItems . size ( ) ; } else { divisor = subActionItems . size ( ) - 1 ; } // Measure this path, in order to find points that have the same distance between each other for ( int i = 0 ; i < subActionItems . size ( ) ; i ++ ) { float [ ] coords = new float [ ] { 0f , 0f } ; measure . getPosTan ( ( i ) * measure . getLength ( ) / divisor , coords , null ) ; // get the x and y values of these points and set them to each of sub action items. subActionItems . get ( i ) . x = ( int ) coords [ 0 ] - subActionItems . get ( i ) . width / 2 ; subActionItems . get ( i ) . y = ( int ) coords [ 1 ] - subActionItems . get ( i ) . height / 2 ; } return center ; }
Calculates the desired positions of all items.
@return getActionViewCenter()
Calculates the desired positions of all items .