Skip to content

Commit 38179bc

Browse files
authored
Merge pull request #642 from AppDevNext/annotationColor
Add @ColorInt annotation to indicate what color is
2 parents f84877f + 14850f1 commit 38179bc

22 files changed

+59
-11
lines changed

chartLib/src/main/kotlin/info/appdev/charting/charts/RadarChart.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.graphics.Canvas
55
import android.graphics.Color
66
import android.util.AttributeSet
7+
import androidx.annotation.ColorInt
78
import info.appdev.charting.components.YAxis
89
import info.appdev.charting.components.YAxis.AxisDependency
910
import info.appdev.charting.data.RadarData
@@ -39,6 +40,7 @@ open class RadarChart : PieRadarChartBase<RadarData> {
3940
/**
4041
* color for the main web lines
4142
*/
43+
@ColorInt
4244
var webColor: Int = Color.rgb(122, 122, 122)
4345

4446
/**

chartLib/src/main/kotlin/info/appdev/charting/components/AxisBase.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package info.appdev.charting.components
33
import android.graphics.Color
44
import android.graphics.DashPathEffect
55
import android.graphics.Paint
6+
import androidx.annotation.ColorInt
67
import info.appdev.charting.formatter.DefaultAxisValueFormatter
78
import info.appdev.charting.formatter.IAxisValueFormatter
89
import info.appdev.charting.utils.convertDpToPixel
@@ -22,16 +23,15 @@ abstract class AxisBase : ComponentBase() {
2223
* The color of the grid lines for this axis (the horizontal lines
2324
* coming from each label).
2425
*/
26+
@ColorInt
2527
var gridColor: Int = Color.GRAY
2628

2729
private var mGridLineWidth = 1f
2830

2931
/**
3032
* Returns the color of the axis line (line alongside the axis).
3133
*/
32-
/**
33-
* Sets the color of the border surrounding the chart.
34-
*/
34+
@ColorInt
3535
var axisLineColor: Int = Color.GRAY
3636

3737
private var mAxisLineWidth = 1f

chartLib/src/main/kotlin/info/appdev/charting/components/ComponentBase.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package info.appdev.charting.components
22

33
import android.graphics.Color
44
import android.graphics.Typeface
5+
import androidx.annotation.ColorInt
56
import info.appdev.charting.utils.convertDpToPixel
67

78
/**
@@ -37,6 +38,7 @@ abstract class ComponentBase {
3738
/**
3839
* the text color to use for the labels
3940
*/
41+
@ColorInt
4042
open var textColor: Int = Color.BLACK
4143

4244
/**

chartLib/src/main/kotlin/info/appdev/charting/components/LegendEntry.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package info.appdev.charting.components
22

33
import android.graphics.DashPathEffect
4+
import androidx.annotation.ColorInt
45
import info.appdev.charting.components.Legend.LegendForm
56
import info.appdev.charting.utils.ColorTemplate
67

@@ -23,7 +24,7 @@ class LegendEntry {
2324
formSize: Float,
2425
formLineWidth: Float,
2526
formLineDashEffect: DashPathEffect?,
26-
formColor: Int
27+
@ColorInt formColor: Int
2728
) {
2829
this.label = label
2930
this.form = form
@@ -72,5 +73,6 @@ class LegendEntry {
7273
/**
7374
* The color for drawing the form
7475
*/
76+
@ColorInt
7577
var formColor: Int = ColorTemplate.COLOR_NONE
7678
}

chartLib/src/main/kotlin/info/appdev/charting/components/LimitLine.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package info.appdev.charting.components
33
import android.graphics.Color
44
import android.graphics.DashPathEffect
55
import android.graphics.Paint
6+
import androidx.annotation.ColorInt
67
import info.appdev.charting.utils.convertDpToPixel
78

89
/**
@@ -18,6 +19,7 @@ class LimitLine : ComponentBase {
1819
private var mLineWidth = 2f
1920

2021
/** the color of the limit line */
22+
@ColorInt
2123
var lineColor: Int = Color.rgb(237, 91, 91)
2224

2325
/** the style of the label text */

chartLib/src/main/kotlin/info/appdev/charting/components/LimitRange.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package info.appdev.charting.components
33
import android.graphics.Color
44
import android.graphics.DashPathEffect
55
import android.graphics.Paint
6+
import androidx.annotation.ColorInt
67
import info.appdev.charting.components.LimitLine.LimitLabelPosition
78
import info.appdev.charting.utils.convertDpToPixel
89

@@ -40,11 +41,13 @@ class LimitRange : ComponentBase {
4041
/**
4142
* the color of the limit line
4243
*/
44+
@ColorInt
4345
var lineColor: Int = Color.rgb(237, 91, 91)
4446

4547
/**
4648
* the color of the Range
4749
*/
50+
@ColorInt
4851
var rangeColor: Int = Color.rgb(128, 128, 128)
4952

5053
/**

chartLib/src/main/kotlin/info/appdev/charting/components/YAxis.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package info.appdev.charting.components
22

33
import android.graphics.Color
44
import android.graphics.Paint
5+
import androidx.annotation.ColorInt
56
import info.appdev.charting.utils.calcTextHeight
67
import info.appdev.charting.utils.calcTextWidth
78
import info.appdev.charting.utils.convertDpToPixel
@@ -43,6 +44,7 @@ open class YAxis : AxisBase {
4344
/**
4445
* Color of the zero line
4546
*/
47+
@ColorInt
4648
var zeroLineColor: Int = Color.GRAY
4749

4850
/**

chartLib/src/main/kotlin/info/appdev/charting/data/BarDataSet.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package info.appdev.charting.data
22

33
import android.graphics.Color
4+
import androidx.annotation.ColorInt
45
import info.appdev.charting.interfaces.datasets.IBarDataSet
56
import info.appdev.charting.utils.Fill
67

@@ -14,10 +15,12 @@ open class BarDataSet(yVals: MutableList<BarEntry>, label: String) : BarLineScat
1415
/**
1516
* the color used for drawing the bar shadows
1617
*/
18+
@ColorInt
1719
private var mBarShadowColor = Color.rgb(215, 215, 215)
1820

1921
private var mBarBorderWidth = 0.0f
2022

23+
@ColorInt
2124
private var mBarBorderColor = Color.BLACK
2225

2326
/**
@@ -89,7 +92,7 @@ open class BarDataSet(yVals: MutableList<BarEntry>, label: String) : BarLineScat
8992
/**
9093
* Sets the start and end color for gradient color, ONLY color that should be used for this DataSet.
9194
*/
92-
fun setGradientColor(startColor: Int, endColor: Int) {
95+
fun setGradientColor(@ColorInt startColor: Int, @ColorInt endColor: Int) {
9396
gradients.clear()
9497
gradients.add(Fill(startColor, endColor))
9598
}

chartLib/src/main/kotlin/info/appdev/charting/data/BarLineScatterCandleBubbleDataSet.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package info.appdev.charting.data
22

33
import android.graphics.Color
4+
import androidx.annotation.ColorInt
45
import info.appdev.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet
56

67
/**
@@ -11,6 +12,7 @@ abstract class BarLineScatterCandleBubbleDataSet<T : Entry>(yVals: MutableList<T
1112
/**
1213
* Sets the color that is used for drawing the highlight indicators.
1314
*/
15+
@ColorInt
1416
override var highLightColor: Int = Color.rgb(255, 187, 115)
1517

1618
protected fun copy(barLineScatterCandleBubbleDataSet: BarLineScatterCandleBubbleDataSet<*>) {

chartLib/src/main/kotlin/info/appdev/charting/data/BaseDataSet.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.graphics.Color
55
import android.graphics.DashPathEffect
66
import android.graphics.Typeface
7+
import androidx.annotation.ColorInt
78
import androidx.core.content.ContextCompat
89
import info.appdev.charting.components.Legend.LegendForm
910
import info.appdev.charting.components.YAxis.AxisDependency
@@ -22,11 +23,13 @@ abstract class BaseDataSet<T : Entry>() : IDataSet<T> {
2223
/**
2324
* List representing all colors that are used for this DataSet
2425
*/
26+
@ColorInt
2527
protected var mColors: MutableList<Int>
2628

2729
/**
2830
* List representing all colors that are used for drawing the actual values for this DataSet
2931
*/
32+
@ColorInt
3033
protected var mValueColors: MutableList<Int>
3134

3235
/**

0 commit comments

Comments
 (0)