Skip to content

Commit 37bf66c

Browse files
authored
Merge pull request #767 from AppDevNext/LegacyEntry
Add legacy Entries to help migration to 5.1
2 parents bb444a6 + 21d69fc commit 37bf66c

29 files changed

Lines changed: 686 additions & 72 deletions

app/build.gradle.kts

Lines changed: 5 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;
@@ -56,6 +59,8 @@ android {
5659
}
5760

5861
dependencies {
62+
lintChecks(project(":lint"))
63+
5964
implementation("androidx.appcompat:appcompat:1.7.1")
6065
implementation("com.google.android.material:material:1.13.0")
6166
implementation(project(":chartLib"))

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+

app/src/main/kotlin/info/appdev/chartexample/BubbleChartActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import info.appdev.charting.components.Legend
1919
import info.appdev.charting.components.XAxis
2020
import info.appdev.charting.data.BubbleData
2121
import info.appdev.charting.data.BubbleDataSet
22+
import info.appdev.charting.data.BubbleEntry
2223
import info.appdev.charting.data.BubbleEntryFloat
2324
import info.appdev.charting.data.EntryFloat
2425
import info.appdev.charting.highlight.Highlight

build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath("com.android.tools.build:gradle:9.1.0")
7+
// Lint API version tracks AGP: AGP 9.1.1 → Lint 32.1.1
8+
// in module lint:
9+
// val lintVersion = "32.1.1"
10+
classpath("com.android.tools.build:gradle:9.1.1")
811
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
912
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.20")
1013
}

chartLib/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ android {
5050
}
5151

5252
dependencies {
53+
lintChecks(project(":lint")) // applies locally
54+
lintPublish(project(path = ":lint", configuration = "lintJar")) // embeds in published AAR
55+
5356
implementation("androidx.annotation:annotation:1.10.0")
5457
implementation("androidx.core:core:1.18.0")
5558
implementation("androidx.activity:activity-ktx:1.13.0")
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package info.appdev.charting.data
2+
3+
import android.graphics.drawable.Drawable
4+
5+
6+
@Deprecated(
7+
message = "The replacement is BarEntryFloat, or use BarEntryDouble for higher precision. BarEntry is retained for backward compatibility but will be removed in a future version.",
8+
replaceWith = ReplaceWith("BarEntryFloat", "info.appdev.charting.data.BarEntryFloat")
9+
)
10+
open class BarEntry : BarEntryFloat {
11+
12+
/**
13+
* Constructor for normal bars (not stacked).
14+
*/
15+
constructor(x: Float, y: Float) : super(x, y)
16+
17+
/**
18+
* Constructor for normal bars (not stacked).
19+
*
20+
* @param x
21+
* @param y
22+
* @param data - Spot for additional data this Entry represents.
23+
*/
24+
constructor(x: Float, y: Float, data: Any?) : super(x, y, data)
25+
26+
/**
27+
* Constructor for normal bars (not stacked).
28+
*
29+
* @param x
30+
* @param y
31+
* @param icon - icon image
32+
*/
33+
constructor(x: Float, y: Float, icon: Drawable?) : super(x, y, icon)
34+
35+
/**
36+
* Constructor for normal bars (not stacked).
37+
*
38+
* @param x
39+
* @param y
40+
* @param icon - icon image
41+
* @param data - Spot for additional data this Entry represents.
42+
*/
43+
constructor(x: Float, y: Float, icon: Drawable?, data: Any?) : super(x, y, icon, data)
44+
45+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package info.appdev.charting.data
2+
3+
import android.annotation.SuppressLint
4+
import android.graphics.drawable.Drawable
5+
6+
@Deprecated(
7+
message = "The replacement is BubbleEntryFloat, or use BubbleEntryDouble for higher precision. BubbleEntry is retained for backward compatibility but will be removed in a future version.",
8+
replaceWith = ReplaceWith("BubbleEntryFloat", "info.appdev.charting.data.BubbleEntryFloat")
9+
)
10+
class BubbleEntry : BubbleEntryFloat {
11+
12+
/**
13+
* Constructor.
14+
*
15+
* @param x The value on the x-axis.
16+
* @param y The value on the y-axis.
17+
* @param size The size of the bubble.
18+
*/
19+
constructor(x: Float, y: Float, size: Float) : super(x, y, size) {
20+
this.size = size
21+
}
22+
23+
/**
24+
* Constructor.
25+
*
26+
* @param x The value on the x-axis.
27+
* @param y The value on the y-axis.
28+
* @param size The size of the bubble.
29+
* @param data Spot for additional data this Entry represents.
30+
*/
31+
constructor(x: Float, y: Float, size: Float, data: Any?) : super(x, y, size, data) {
32+
this.size = size
33+
}
34+
35+
/**
36+
* Constructor.
37+
*
38+
* @param x The value on the x-axis.
39+
* @param y The value on the y-axis.
40+
* @param size The size of the bubble.
41+
* @param icon Icon image
42+
*/
43+
constructor(x: Float, y: Float, size: Float, icon: Drawable?) : super(x, y, size, icon) {
44+
this.size = size
45+
}
46+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package info.appdev.charting.data
2+
3+
import android.graphics.drawable.Drawable
4+
5+
@Deprecated(
6+
message = "The replacement is CandleEntryFloat, or use CandleEntryDouble for higher precision. CandleEntry is retained for backward compatibility but will be removed in a future version.",
7+
replaceWith = ReplaceWith("CandleEntryFloat", "info.appdev.charting.data.CandleEntryFloat")
8+
)
9+
class CandleEntry : CandleEntryFloat {
10+
11+
/**
12+
* Constructor.
13+
*
14+
* @param x The value on the x-axis
15+
* @param shadowH The (shadow) high value
16+
* @param shadowL The (shadow) low value
17+
* @param open The open value
18+
* @param close The close value
19+
*/
20+
constructor(x: Float, shadowH: Float, shadowL: Float, open: Float, close: Float) : super(x, shadowH, shadowL, open, close) {
21+
this.high = shadowH
22+
this.low = shadowL
23+
this.open = open
24+
this.close = close
25+
}
26+
27+
/**
28+
* Constructor.
29+
*
30+
* @param x The value on the x-axis
31+
* @param shadowH The (shadow) high value
32+
* @param shadowL The (shadow) low value
33+
* @param data Spot for additional data this Entry represents
34+
*/
35+
constructor(
36+
x: Float, shadowH: Float, shadowL: Float, open: Float, close: Float,
37+
data: Any?
38+
) : super(x, shadowH, shadowL, open, close) {
39+
this.high = shadowH
40+
this.low = shadowL
41+
this.open = open
42+
this.close = close
43+
}
44+
45+
/**
46+
* Constructor.
47+
*
48+
* @param x The value on the x-axis
49+
* @param shadowH The (shadow) high value
50+
* @param shadowL The (shadow) low value
51+
* @param icon Icon image
52+
*/
53+
constructor(
54+
x: Float, shadowH: Float, shadowL: Float, open: Float, close: Float,
55+
icon: Drawable?
56+
) : super(x, shadowH, shadowL, open, close) {
57+
this.high = shadowH
58+
this.low = shadowL
59+
this.open = open
60+
this.close = close
61+
}
62+
63+
/**
64+
* Constructor.
65+
*
66+
* @param x The value on the x-axis
67+
* @param shadowH The (shadow) high value
68+
* @param shadowL The (shadow) low value
69+
* @param icon Icon image
70+
* @param data Spot for additional data this Entry represents
71+
*/
72+
constructor(
73+
x: Float, shadowH: Float, shadowL: Float, open: Float, close: Float,
74+
icon: Drawable?, data: Any?
75+
) : super(x, shadowH, shadowL, open, close) {
76+
this.high = shadowH
77+
this.low = shadowL
78+
this.open = open
79+
this.close = close
80+
}
81+
82+
}

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

0 commit comments

Comments
 (0)