Skip to content

Commit 21d69fc

Browse files
committed
Handle RawTypeDataSetDetector for datasets in lib
1 parent 61a9f7a commit 21d69fc

File tree

13 files changed

+36
-10
lines changed

13 files changed

+36
-10
lines changed

app/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ android {
4646
testOptions {
4747
animationsDisabled = true
4848
}
49+
lint {
50+
lintConfig = file("lint.xml")
51+
}
4952
packaging {
5053
jniLibs {
5154
// androidx.graphics:graphics-path ships a .so that llvm-strip cannot process;

app/lint.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Lint suppressions for the sample/demo app module.
4+
These issues are intentionally suppressed here because this module
5+
demonstrates legacy API usage. The rules still apply to library consumers.
6+
-->
7+
<lint>
8+
<!-- Demo app intentionally uses LineDataSet without explicit type args for brevity. -->
9+
<issue id="RawTypeDataSet" severity="ignore" />
10+
</lint>
11+

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

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

3+
import android.annotation.SuppressLint
34
import android.graphics.Typeface
45
import info.appdev.charting.components.YAxis.AxisDependency
56
import info.appdev.charting.formatter.IValueFormatter
@@ -440,6 +441,7 @@ abstract class ChartData<T : IDataSet<out EntryFloat>> : Serializable {
440441
* specified index. Returns true if an Entry was removed, false if no Entry
441442
* was found that meets the specified requirements.
442443
*/
444+
@SuppressLint("RawTypeDataSet")
443445
open fun removeEntry(xValue: Float, dataSetIndex: Int): Boolean {
444446
if (dataSetIndex >= dataSets.size) {
445447
return false

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

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

3+
import android.annotation.SuppressLint
34
import timber.log.Timber
45
import java.io.Serializable
56
import kotlin.math.abs
@@ -130,7 +131,7 @@ abstract class DataSet<T : BaseEntry<Float>>(
130131
*/
131132
abstract fun copy(): DataSet<T>?
132133

133-
protected fun copy(dataSet: DataSet<*>) {
134+
protected fun copy(@SuppressLint("RawTypeDataSet") dataSet: DataSet<*>) {
134135
super.copy(dataSet)
135136
}
136137

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

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

3+
import android.annotation.SuppressLint
34
import android.content.Context
45
import android.graphics.Color
56
import android.graphics.DashPathEffect
@@ -84,7 +85,7 @@ open class LineDataSet<T : BaseEntry<Float>>(yVals: MutableList<T> = mutableList
8485
return copied as DataSet<T>
8586
}
8687

87-
protected fun copy(lineDataSet: LineDataSet<*>) {
88+
protected fun copy(@SuppressLint("RawTypeDataSet") lineDataSet: LineDataSet<*>) {
8889
super.copy((lineDataSet as BaseDataSet<*>?)!!)
8990
lineDataSet.circleColors = this.circleColors
9091
lineDataSet.mCircleHoleColor = mCircleHoleColor

chartLib/src/main/kotlin/info/appdev/charting/highlight/ChartHighlighter.kt

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

3+
import android.annotation.SuppressLint
34
import info.appdev.charting.components.YAxis.AxisDependency
45
import info.appdev.charting.data.ChartData
56
import info.appdev.charting.data.DataSet
@@ -115,7 +116,7 @@ open class ChartHighlighter<T : BarLineScatterCandleBubbleDataProvider<*>>(prote
115116
*/
116117
@Suppress("SameParameterValue")
117118
protected open fun buildHighlights(
118-
set: IDataSet<*>,
119+
@SuppressLint("RawTypeDataSet") set: IDataSet<*>,
119120
dataSetIndex: Int,
120121
xVal: Float,
121122
rounding: DataSet.Rounding?

chartLib/src/main/kotlin/info/appdev/charting/highlight/HorizontalBarHighlighter.kt

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

3+
import android.annotation.SuppressLint
34
import info.appdev.charting.data.DataSet
45
import info.appdev.charting.data.EntryFloat
56
import info.appdev.charting.interfaces.dataprovider.BarDataProvider
@@ -32,7 +33,7 @@ class HorizontalBarHighlighter(dataProvider: BarDataProvider) : BarHighlighter(d
3233
return null
3334
}
3435

35-
override fun buildHighlights(set: IDataSet<*>, dataSetIndex: Int, xVal: Float, rounding: DataSet.Rounding?): MutableList<Highlight> {
36+
override fun buildHighlights(@SuppressLint("RawTypeDataSet") set: IDataSet<*>, dataSetIndex: Int, xVal: Float, rounding: DataSet.Rounding?): MutableList<Highlight> {
3637
val highlights = ArrayList<Highlight>()
3738

3839
var entries = set.getEntriesForXValue(xVal)?.map { it as EntryFloat }?.toMutableList()

chartLib/src/main/kotlin/info/appdev/charting/listener/OnDrawListener.kt

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

3+
import android.annotation.SuppressLint
34
import info.appdev.charting.data.DataSet
45
import info.appdev.charting.data.EntryFloat
56

@@ -25,5 +26,5 @@ interface OnDrawListener {
2526
*
2627
* @param dataSet the last drawn DataSet
2728
*/
28-
fun onDrawFinished(dataSet: DataSet<*>)
29+
fun onDrawFinished(@SuppressLint("RawTypeDataSet") dataSet: DataSet<*>)
2930
}

chartLib/src/main/kotlin/info/appdev/charting/renderer/BarLineScatterCandleBubbleRenderer.kt

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

3+
import android.annotation.SuppressLint
34
import info.appdev.charting.animation.ChartAnimator
45
import info.appdev.charting.data.DataSet
56
import info.appdev.charting.data.BaseEntry
@@ -22,7 +23,7 @@ abstract class BarLineScatterCandleBubbleRenderer(
2223
/**
2324
* Returns true if the DataSet values should be drawn, false if not.
2425
*/
25-
protected fun shouldDrawValues(set: IDataSet<*>): Boolean {
26+
protected fun shouldDrawValues(@SuppressLint("RawTypeDataSet") set: IDataSet<*>): Boolean {
2627
return set.isVisible && (set.isDrawValues || set.isDrawIcons)
2728
}
2829

chartLib/src/main/kotlin/info/appdev/charting/renderer/DataRenderer.kt

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

3+
import android.annotation.SuppressLint
34
import android.graphics.Canvas
45
import android.graphics.Color
56
import android.graphics.Paint
@@ -70,7 +71,7 @@ abstract class DataRenderer(
7071
* Applies the required styling (provided by the DataSet) to the value-paint
7172
* object.
7273
*/
73-
protected fun applyValueTextStyle(set: IDataSet<*>) {
74+
protected fun applyValueTextStyle(@SuppressLint("RawTypeDataSet") set: IDataSet<*>) {
7475
paintValues.typeface = set.valueTypeface
7576
paintValues.textSize = set.valueTextSize
7677
}

0 commit comments

Comments
 (0)