Skip to content

Commit 2393a80

Browse files
committed
add comments for UndocumentedPublicFunction
1 parent 75a71a8 commit 2393a80

File tree

17 files changed

+188
-29
lines changed

17 files changed

+188
-29
lines changed

charts/src/main/java/me/bytebeats/views/charts/AxisLine.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ data class AxisLine(
2323
}
2424
}
2525

26+
@Suppress("UndocumentedPublicFunction")
2627
fun paint(density: Density) {
2728
mPaint.strokeWidth = thickness.value * density.density
2829
}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package me.bytebeats.views.charts
22

33
import androidx.compose.ui.graphics.Color
4+
import me.bytebeats.views.charts.util.FLOAT_0_5
5+
import me.bytebeats.views.charts.util.FLOAT_255
46

57
/**
68
* Created by bytebeats on 2021/9/24 : 10:51
@@ -10,9 +12,9 @@ import androidx.compose.ui.graphics.Color
1012

1113
fun Color.toLegacyInt(): Int {
1214
return android.graphics.Color.argb(
13-
(alpha * 255F + .5F).toInt(),
14-
(red * 255F + .5F).toInt(),
15-
(green * 255F + .5F).toInt(),
16-
(blue * 255F + .5F).toInt()
15+
(alpha * FLOAT_255 + FLOAT_0_5).toInt(),
16+
(red * FLOAT_255 + FLOAT_0_5).toInt(),
17+
(green * FLOAT_255 + FLOAT_0_5).toInt(),
18+
(blue * FLOAT_255 + FLOAT_0_5).toInt()
1719
)
18-
}
20+
}

charts/src/main/java/me/bytebeats/views/charts/bar/render/bar/IBarDrawer.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ import me.bytebeats.views.charts.bar.BarChartData
1111
* Quote: Peasant. Educated. Worker
1212
*/
1313
interface IBarDrawer {
14+
15+
/**
16+
* Draw bar
17+
*
18+
* @param drawScope the scope to draw
19+
* @param canvas the Canvas to draw on
20+
* @param barArea the bar area to draw
21+
* @param bar the bar data
22+
*/
1423
fun drawBar(
1524
drawScope: DrawScope,
1625
canvas: Canvas,

charts/src/main/java/me/bytebeats/views/charts/bar/render/label/ILabelDrawer.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,34 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
1010
* Quote: Peasant. Educated. Worker
1111
*/
1212
interface ILabelDrawer {
13+
14+
15+
/**
16+
* Required x axis height
17+
*
18+
* @param drawScope the scope to draw in
19+
* @return required height
20+
*/
1321
fun requiredXAxisHeight(drawScope: DrawScope): Float = 0F
22+
23+
24+
/**
25+
* Required above bar height
26+
*
27+
* @param drawScope the scope to draw in
28+
* @return required height
29+
*/
1430
fun requiredAboveBarHeight(drawScope: DrawScope): Float = 0F
31+
32+
/**
33+
* Draw label
34+
*
35+
* @param drawScope the scope to draw in
36+
* @param canvas the canvas to draw on
37+
* @param label the label to draw on the axis
38+
* @param barArea the area to draw a bar
39+
* @param xAxisArea the x axis area to draw
40+
*/
1541
fun drawLabel(
1642
drawScope: DrawScope,
1743
canvas: Canvas,

charts/src/main/java/me/bytebeats/views/charts/bar/render/xaxis/IXAxisDrawer.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,22 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
1010
* Quote: Peasant. Educated. Worker
1111
*/
1212
interface IXAxisDrawer {
13+
14+
/**
15+
* Required height
16+
*
17+
* @param drawScope the draw scope to require height
18+
* @return required height
19+
*/
1320
fun requiredHeight(drawScope: DrawScope): Float
21+
22+
/**
23+
* Draw x axis line
24+
*
25+
* @param drawScope the scope to draw
26+
* @param canvas the canvas to draw on
27+
* @param drawableArea the area to draw a drawable
28+
*/
1429
fun drawXAxisLine(
1530
drawScope: DrawScope,
1631
canvas: Canvas,

charts/src/main/java/me/bytebeats/views/charts/bar/render/yaxis/IYAxisDrawer.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,30 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
1010
* Quote: Peasant. Educated. Worker
1111
*/
1212
interface IYAxisDrawer {
13+
14+
/**
15+
* Draw axis line
16+
*
17+
* @param drawScope the scope to draw
18+
* @param canvas the canvas to draw on
19+
* @param drawableArea the area to draw a drawable
20+
*/
1321
fun drawAxisLine(
1422
drawScope: DrawScope,
1523
canvas: Canvas,
1624
drawableArea: Rect
1725
)
1826

27+
28+
/**
29+
* Draw axis labels
30+
*
31+
* @param drawScope the scope to draw
32+
* @param canvas the canvas to draw on
33+
* @param drawableArea the drawable area
34+
* @param minValue the min value of the y axis data
35+
* @param maxValue the max value of the y axis data
36+
*/
1937
fun drawAxisLabels(
2038
drawScope: DrawScope,
2139
canvas: Canvas,

charts/src/main/java/me/bytebeats/views/charts/line/LineCharts.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import me.bytebeats.views.charts.util.FLOAT_100
1515
* Quote: Peasant. Educated. Worker
1616
*/
1717

18-
fun computeDrawableArea(
18+
internal fun computeDrawableArea(
1919
xAxisDrawableArea: Rect,
2020
yAxisDrawableArea: Rect,
2121
size: Size,
@@ -30,7 +30,7 @@ fun computeDrawableArea(
3030
)
3131
}
3232

33-
fun computeXAxisDrawableArea(
33+
internal fun computeXAxisDrawableArea(
3434
yAxisWidth: Float,
3535
labelHeight: Float,
3636
size: Size
@@ -44,7 +44,7 @@ fun computeXAxisDrawableArea(
4444
)
4545
}
4646

47-
fun computeXAxisLabelsDrawableArea(
47+
internal fun computeXAxisLabelsDrawableArea(
4848
xAxisDrawableArea: Rect,
4949
offset: Float
5050
): Rect {
@@ -57,7 +57,7 @@ fun computeXAxisLabelsDrawableArea(
5757
)
5858
}
5959

60-
fun Density.computeYAxisDrawableArea(
60+
internal fun Density.computeYAxisDrawableArea(
6161
xAxisLabelSize: Float,
6262
size: Size
6363
): Rect {
@@ -71,7 +71,7 @@ fun Density.computeYAxisDrawableArea(
7171
)
7272
}
7373

74-
fun computePointLocation(
74+
internal fun computePointLocation(
7575
drawableArea: Rect,
7676
lineChartData: LineChartData,
7777
point: LineChartData.Point,
@@ -85,7 +85,7 @@ fun computePointLocation(
8585
)
8686
}
8787

88-
fun withProgress(
88+
internal fun withProgress(
8989
index: Int,
9090
lineChartData: LineChartData,
9191
transitionProgress: Float,
@@ -103,7 +103,7 @@ fun withProgress(
103103
}
104104
}
105105

106-
fun computeLinePath(
106+
internal fun computeLinePath(
107107
drawableArea: Rect,
108108
lineChartData: LineChartData,
109109
transitionProgress: Float
@@ -130,7 +130,7 @@ fun computeLinePath(
130130
}
131131
}
132132

133-
fun computeFillPath(
133+
internal fun computeFillPath(
134134
drawableArea: Rect,
135135
lineChartData: LineChartData,
136136
transitionProgress: Float

charts/src/main/java/me/bytebeats/views/charts/line/render/line/ILineDrawer.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
1010
* Quote: Peasant. Educated. Worker
1111
*/
1212
interface ILineDrawer {
13+
14+
/**
15+
* Draw line
16+
*
17+
* @param drawScope the scope to draw in
18+
* @param canvas the canvas to draw on
19+
* @param linePath the line path to draw
20+
*/
1321
fun drawLine(
1422
drawScope: DrawScope,
1523
canvas: Canvas,

charts/src/main/java/me/bytebeats/views/charts/line/render/line/ILineShader.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
1010
* Quote: Peasant. Educated. Worker
1111
*/
1212
interface ILineShader {
13+
14+
/**
15+
* fill slice
16+
*
17+
* @param drawScope the scope to draw in
18+
* @param canvas the canvas to draw on
19+
* @param fillPath the path to fill
20+
*/
1321
fun fillLine(
1422
drawScope: DrawScope,
1523
canvas: Canvas,

charts/src/main/java/me/bytebeats/views/charts/line/render/point/IPointDrawer.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ import androidx.compose.ui.graphics.drawscope.DrawScope
1010
* Quote: Peasant. Educated. Worker
1111
*/
1212
interface IPointDrawer {
13+
14+
/**
15+
* Draw point
16+
*
17+
* @param drawScope the scope to draw in
18+
* @param canvas the canvas to draw on
19+
* @param center the center point to draw a point
20+
*/
1321
fun drawPoint(
1422
drawScope: DrawScope,
1523
canvas: Canvas,

0 commit comments

Comments
 (0)