Skip to content

Commit 75d3ea4

Browse files
authored
Merge pull request #592 from AppDevNext/RemoveJvmFields
Remove JvmField
2 parents 36db292 + 0cc9b99 commit 75d3ea4

28 files changed

+37
-182
lines changed

chartLib/src/main/kotlin/info/appdev/charting/buffer/AbstractBuffer.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,15 @@ package info.appdev.charting.buffer
77
</T> */
88
abstract class AbstractBuffer<T>(size: Int) {
99
/** index in the buffer */
10-
@JvmField
1110
protected var index: Int = 0
1211

1312
/** float-buffer that holds the data points to draw, order: x,y,x,y,... */
14-
@JvmField
1513
val buffer: FloatArray
1614

1715
/** animation phase x-axis */
18-
@JvmField
1916
protected var phaseX: Float = 1f
2017

2118
/** animation phase y-axis */
22-
@JvmField
2319
protected var phaseY: Float = 1f
2420

2521
/** indicates from which x-index the visible data begins */

chartLib/src/main/kotlin/info/appdev/charting/buffer/BarBuffer.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,22 @@ open class BarBuffer(size: Int, dataSetCount: Int, containsStacks: Boolean) : Ab
77
protected var dataSetIndex: Int = 0
88
protected var dataSetCount: Int = 1
99

10-
@JvmField
1110
protected var containsStacks: Boolean = false
1211

13-
@JvmField
14-
protected var inverted: Boolean = false
12+
var inverted: Boolean = false
1513

1614
/** width of the bar on the x-axis, in values (not pixels) */
17-
@JvmField
18-
protected var barWidth: Float = 1f
15+
var barWidth: Float = 1f
1916

2017
init {
2118
this.dataSetCount = dataSetCount
2219
this.containsStacks = containsStacks
2320
}
2421

25-
fun setBarWidth(barWidthGiven: Float) {
26-
this.barWidth = barWidthGiven
27-
}
28-
2922
fun setDataSet(index: Int) {
3023
this.dataSetIndex = index
3124
}
3225

33-
fun setInverted(invertedGiven: Boolean) {
34-
this.inverted = invertedGiven
35-
}
36-
3726
protected fun addBar(left: Float, top: Float, right: Float, bottom: Float) {
3827
buffer[index++] = left
3928
buffer[index++] = top

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

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
6666
* object that holds all data that was originally set for the chart, before
6767
* it was modified or any filtering algorithms had been applied
6868
*/
69-
@JvmField
7069
protected var mData: T? = null
7170

7271
/**
@@ -120,13 +119,11 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
120119
/**
121120
* the object representing the labels on the x-axis
122121
*/
123-
@JvmField
124122
protected var mXAxis: XAxis = XAxis()
125123

126124
/**
127125
* if true, touch gestures are enabled on the chart
128126
*/
129-
@JvmField
130127
protected var mTouchEnabled: Boolean = true
131128

132129
/**
@@ -186,7 +183,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
186183
/**
187184
* object responsible for rendering the data
188185
*/
189-
@JvmField
190186
protected var mRenderer: DataRenderer? = null
191187

192188
var highlighter: IHighlighter? = null
@@ -195,9 +191,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
195191
/**
196192
* Returns the ViewPortHandler of the chart that is responsible for the
197193
* content area of the chart and its offsets and dimensions.
198-
*/
199-
/**
200-
* object that manages the bounds and drawing constraints of the chart
194+
* Object that manages the bounds and drawing constraints of the chart
201195
*/
202196
var viewPortHandler: ViewPortHandler = ViewPortHandler()
203197
protected set
@@ -281,39 +275,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
281275
this.legendRenderer = LegendRenderer(this.viewPortHandler, this.legend!!)
282276
}
283277

284-
// public void initWithDummyData() {
285-
// ColorTemplate template = new ColorTemplate();
286-
// template.addColorsForDataSets(ColorTemplate.COLORFUL_COLORS,
287-
// getContext());
288-
//
289-
// setColorTemplate(template);
290-
// setDrawYValues(false);
291-
//
292-
// ArrayList<String> xVals = new ArrayList<String>();
293-
// Calendar calendar = Calendar.getInstance();
294-
// for (int i = 0; i < 12; i++) {
295-
// xVals.add(calendar.getDisplayName(Calendar.MONTH, Calendar.SHORT,
296-
// Locale.getDefault()));
297-
// }
298-
//
299-
// ArrayList<DataSet> dataSets = new ArrayList<DataSet>();
300-
// for (int i = 0; i < 3; i++) {
301-
//
302-
// ArrayList<Entry> yVals = new ArrayList<Entry>();
303-
//
304-
// for (int j = 0; j < 12; j++) {
305-
// float val = (float) (Math.random() * 100);
306-
// yVals.add(new Entry(val, j));
307-
// }
308-
//
309-
// DataSet set = new DataSet(yVals, "DataSet " + i);
310-
// dataSets.add(set); // add the datasets
311-
// }
312-
// // create a data object with the datasets
313-
// ChartData data = new ChartData(xVals, dataSets);
314-
// setData(data);
315-
// invalidate();
316-
// }
317278
/**
318279
* Sets a new data object for the chart. The data object contains all values
319280
* and information needed for displaying.
@@ -574,7 +535,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
574535
* @param dataIndex The data index to search in (only used in CombinedChartView currently)
575536
* @param callListener Should the listener be called for this change
576537
*/
577-
@JvmOverloads
578538
fun highlightValue(x: Float, dataSetIndex: Int, dataIndex: Int = -1, callListener: Boolean = true) {
579539
highlightValue(x, Float.NaN, dataSetIndex, dataIndex, callListener)
580540
}
@@ -601,7 +561,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
601561
* @param dataSetIndex The dataset index to search in
602562
* @param dataIndex The data index to search in (only used in CombinedChartView currently)
603563
*/
604-
@JvmOverloads
605564
fun highlightValue(x: Float, y: Float, dataSetIndex: Int, dataIndex: Int = -1, callListener: Boolean = true) {
606565
if (dataSetIndex < 0 || dataSetIndex >= mData!!.dataSetCount) {
607566
highlightValue(null, callListener)
@@ -1221,7 +1180,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
12211180
* @param quality e.g. 50, min = 0, max = 100
12221181
* @return returns true if saving was successful, false if not
12231182
*/
1224-
@JvmOverloads
12251183
fun saveToGallery(
12261184
fileName: String,
12271185
subFolderPath: String? = "",

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ abstract class AxisBase : ComponentBase() {
5353
/**
5454
* the number of entries the legend contains
5555
*/
56-
@JvmField
5756
var entryCount: Int = 0
5857

5958
/**
@@ -215,19 +214,16 @@ abstract class AxisBase : ComponentBase() {
215214
/**
216215
* don't touch this direclty, use setter
217216
*/
218-
@JvmField
219217
var mAxisMaximum: Float = 0f
220218

221219
/**
222220
* don't touch this directly, use setter
223221
*/
224-
@JvmField
225222
var mAxisMinimum: Float = 0f
226223

227224
/**
228225
* the total range of values this axis covers
229226
*/
230-
@JvmField
231227
var mAxisRange: Float = 0f
232228

233229
private var mAxisMinLabels = 2

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ abstract class ComponentBase {
1717
/**
1818
* the offset in pixels this component has on the x-axis
1919
*/
20-
@JvmField
2120
protected var mXOffset: Float = 5f
2221

2322
/**
2423
* the offset in pixels this component has on the Y-axis
2524
*/
26-
@JvmField
2725
protected var mYOffset: Float = 5f
2826

2927
/**
@@ -34,7 +32,6 @@ abstract class ComponentBase {
3432
/**
3533
* the text size of the labels
3634
*/
37-
@JvmField
3835
protected var mTextSize: Float = 10f.convertDpToPixel()
3936

4037
/**

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ class Description : ComponentBase() {
88
/**
99
* Sets the text to be shown as the description.
1010
* Never set this to null as this will cause nullpointer exception when drawing with Android Canvas.
11-
*
12-
* @param text
1311
*/
14-
@JvmField
1512
var text: String? = "Description Label"
1613

1714
/**

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -323,29 +323,19 @@ class Legend() : ComponentBase() {
323323

324324
var mTextWidthMax: Float = 0f
325325

326-
/**
327-
* If this is set, then word wrapping the legend is enabled. This means the
328-
* legend will not be cut off if too long.
329-
*/
330326
/**
331327
* Should the legend word wrap? / this is currently supported only for:
332328
* BelowChartLeft, BelowChartRight, BelowChartCenter. / note that word
333329
* wrapping a legend takes a toll on performance. / you may want to set
334330
* maxSizePercent when word wrapping, to set the point where the text wraps.
335331
* / default: false
336332
*/
337-
/**
338-
* flag that indicates if word wrapping is enabled
339-
*/
340333
var isWordWrapEnabled: Boolean = false
341334

342335
val calculatedLabelSizes: MutableList<FSize?> = ArrayList<FSize?>(16)
343336
val calculatedLabelBreakPoints: MutableList<Boolean?> = ArrayList<Boolean?>(16)
344337
val calculatedLineSizes: MutableList<FSize?> = ArrayList<FSize?>(16)
345338

346-
/**
347-
* default constructor
348-
*/
349339
init {
350340
this.mTextSize = 10f.convertDpToPixel()
351341
this.mXOffset = 5f.convertDpToPixel()

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

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import info.appdev.charting.highlight.Highlight
77
import info.appdev.charting.interfaces.datasets.IDataSet
88
import timber.log.Timber
99
import java.io.Serializable
10-
import java.util.Collections
1110

1211
/**
1312
* Class that holds all relevant data that represents the chart. That involves at least one (or more) DataSets, and an array of x-values.
@@ -38,59 +37,29 @@ abstract class ChartData<T : IDataSet<out Entry>> : Serializable {
3837
var xMin: Float = Float.MAX_VALUE
3938
protected set
4039

41-
42-
@JvmField
4340
protected var mLeftAxisMax: Float = -Float.MAX_VALUE
4441

45-
@JvmField
4642
protected var mLeftAxisMin: Float = Float.MAX_VALUE
4743

48-
@JvmField
4944
protected var mRightAxisMax: Float = -Float.MAX_VALUE
5045

51-
@JvmField
5246
protected var mRightAxisMin: Float = Float.MAX_VALUE
5347

54-
/**
55-
* Returns all DataSet objects this ChartData object holds.
56-
*/
5748
/**
5849
* array that holds all DataSets the ChartData object represents
5950
*/
6051
open var dataSets: MutableList<T>? = null
6152
protected set
6253

63-
/**
64-
* Default constructor.
65-
*/
6654
constructor() {
6755
this.dataSets = ArrayList<T>()
6856
}
6957

70-
/**
71-
* Constructor taking single or multiple DataSet objects.
72-
*/
7358
constructor(vararg dataSets: T) {
7459
this.dataSets = dataSets.toMutableList()
7560
notifyDataChanged()
7661
}
7762

78-
/**
79-
* Created because Arrays.asList(...) does not support modification.
80-
*/
81-
private fun arrayToList(array: Array<T>): MutableList<T> {
82-
val list: MutableList<T> = ArrayList()
83-
84-
Collections.addAll(list, *array)
85-
86-
return list
87-
}
88-
89-
/**
90-
* constructor for chart data
91-
*
92-
* @param sets the dataset array
93-
*/
9463
constructor(sets: MutableList<T>) {
9564
this.dataSets = sets
9665
notifyDataChanged()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import kotlin.math.abs
1515
* LineChart, or the values of a specific group of bars in the BarChart).
1616
*/
1717
abstract class DataSet<T : Entry>(
18-
@JvmField protected var mEntries: MutableList<T>?,
18+
protected var mEntries: MutableList<T>?,
1919
label: String = ""
2020
) : BaseDataSet<T>(label), Serializable {
2121
/**

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import timber.log.Timber
66

77
@SuppressLint("ParcelCreator")
88
class PieEntry : Entry {
9-
@JvmField
109
var label: String? = null
1110

1211
constructor(value: Float) : super(0f, value)

0 commit comments

Comments
 (0)