Skip to content

Commit d57fc5f

Browse files
committed
Cosmetic
1 parent a14537b commit d57fc5f

2 files changed

Lines changed: 38 additions & 24 deletions

File tree

chartLib/src/main/kotlin/info/appdev/charting/utils/CanvasUtils.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ private val drawableBoundsCache = Rect()
1515
/**
1616
* Utilities class that has some helper methods. Needs to be initialized by
1717
* calling Utils.init(...) before usage. Inside the Chart.init() method, this is
18-
* done, if the Utils are used before that, Utils.init(...) needs to be called
19-
* manually.
18+
* done, if the Utils are used before that, Utils.init(...) needs to be called manually.
2019
*/
2120
fun Canvas.drawImage(
2221
drawable: Drawable,
@@ -81,9 +80,9 @@ fun Canvas.drawXAxisValue(
8180
// Move the "outer" rect relative to the anchor, assuming its centered
8281
if (anchor.x != 0.5f || anchor.y != 0.5f) {
8382
val rotatedSize = getSizeOfRotatedRectangleByDegrees(
84-
mDrawTextRectBuffer.width().toFloat(),
85-
lineHeight,
86-
angleDegrees
83+
rectangleWidth = mDrawTextRectBuffer.width().toFloat(),
84+
rectangleHeight = lineHeight,
85+
degrees = angleDegrees
8786
)
8887

8988
translateX -= rotatedSize.width * (anchor.x - 0.5f)

chartLib/src/main/kotlin/info/appdev/charting/utils/ColorTemplate.kt

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ package info.appdev.charting.utils
33
import android.graphics.Color
44

55
/**
6-
* Class that holds predefined color integer arrays (e.g.
7-
* ColorTemplate.VORDIPLOM_COLORS) and convenience methods for loading colors
8-
* from resources.
6+
* Class that holds predefined color integer arrays (e.g. ColorTemplate.VORDIPLOM_COLORS)
7+
* and convenience methods for loading colors from resources.
98
*/
109
object ColorTemplate {
1110
/**
@@ -24,27 +23,45 @@ object ColorTemplate {
2423
* FREE TO CREATE YOUR OWN WITH AS MANY DIFFERENT COLORS AS YOU WANT
2524
*/
2625
val LIBERTY_COLORS: IntArray = intArrayOf(
27-
Color.rgb(207, 248, 246), Color.rgb(148, 212, 212), Color.rgb(136, 180, 187),
28-
Color.rgb(118, 174, 175), Color.rgb(42, 109, 130)
26+
Color.rgb(207, 248, 246),
27+
Color.rgb(148, 212, 212),
28+
Color.rgb(136, 180, 187),
29+
Color.rgb(118, 174, 175),
30+
Color.rgb(42, 109, 130)
2931
)
3032
val JOYFUL_COLORS: IntArray = intArrayOf(
31-
Color.rgb(217, 80, 138), Color.rgb(254, 149, 7), Color.rgb(254, 247, 120),
32-
Color.rgb(106, 167, 134), Color.rgb(53, 194, 209)
33+
Color.rgb(217, 80, 138),
34+
Color.rgb(254, 149, 7),
35+
Color.rgb(254, 247, 120),
36+
Color.rgb(106, 167, 134),
37+
Color.rgb(53, 194, 209)
3338
)
3439
val PASTEL_COLORS: IntArray = intArrayOf(
35-
Color.rgb(64, 89, 128), Color.rgb(149, 165, 124), Color.rgb(217, 184, 162),
36-
Color.rgb(191, 134, 134), Color.rgb(179, 48, 80)
40+
Color.rgb(64, 89, 128),
41+
Color.rgb(149, 165, 124),
42+
Color.rgb(217, 184, 162),
43+
Color.rgb(191, 134, 134),
44+
Color.rgb(179, 48, 80)
3745
)
3846
val COLORFUL_COLORS: IntArray = intArrayOf(
39-
Color.rgb(193, 37, 82), Color.rgb(255, 102, 0), Color.rgb(245, 199, 0),
40-
Color.rgb(106, 150, 31), Color.rgb(179, 100, 53)
47+
Color.rgb(193, 37, 82),
48+
Color.rgb(255, 102, 0),
49+
Color.rgb(245, 199, 0),
50+
Color.rgb(106, 150, 31),
51+
Color.rgb(179, 100, 53)
4152
)
4253
val VORDIPLOM_COLORS: IntArray = intArrayOf(
43-
Color.rgb(192, 255, 140), Color.rgb(255, 247, 140), Color.rgb(255, 208, 140),
44-
Color.rgb(140, 234, 255), Color.rgb(255, 140, 157)
54+
Color.rgb(192, 255, 140),
55+
Color.rgb(255, 247, 140),
56+
Color.rgb(255, 208, 140),
57+
Color.rgb(140, 234, 255),
58+
Color.rgb(255, 140, 157)
4559
)
4660
val MATERIAL_COLORS: IntArray = intArrayOf(
47-
rgb("#2ecc71"), rgb("#f1c40f"), rgb("#e74c3c"), rgb("#3498db")
61+
rgb("#2ecc71"),
62+
rgb("#f1c40f"),
63+
rgb("#e74c3c"),
64+
rgb("#3498db")
4865
)
4966

5067
/**
@@ -58,10 +75,10 @@ object ColorTemplate {
5875
return Color.rgb(r, g, b)
5976
}
6077

78+
/**
79+
* Returns the Android ICS holo blue light color.
80+
*/
6181
val holoBlue: Int
62-
/**
63-
* Returns the Android ICS holo blue light color.
64-
*/
6582
get() = Color.rgb(51, 181, 229)
6683

6784
/**
@@ -77,11 +94,9 @@ object ColorTemplate {
7794
*/
7895
fun createColors(colors: IntArray): MutableList<Int> {
7996
val result: MutableList<Int> = ArrayList()
80-
8197
for (i in colors) {
8298
result.add(i)
8399
}
84-
85100
return result
86101
}
87102
}

0 commit comments

Comments
 (0)