Skip to content

Commit c8bb28a

Browse files
committed
Rename
1 parent 7dc3b14 commit c8bb28a

File tree

8 files changed

+46
-44
lines changed

8 files changed

+46
-44
lines changed

app/src/main/kotlin/info/appdev/chartexample/listviewitems/BarChartItem.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ import info.appdev.charting.data.BarData
1111
import info.appdev.charting.data.ChartData
1212
import info.appdev.chartexample.R
1313

14-
class BarChartItem(cd: ChartData<*>, c: Context) : ChartItem(cd) {
15-
private val typeface: Typeface? = Typeface.createFromAsset(c.assets, "OpenSans-Regular.ttf")
14+
class BarChartItem(chartData: ChartData<*>, context: Context) : ChartItem(chartData) {
15+
private val typeface: Typeface? = Typeface.createFromAsset(context.assets, "OpenSans-Regular.ttf")
1616

1717
override val itemType: Int
1818
get() = TYPE_BARCHART
1919

2020
@SuppressLint("InflateParams")
21-
override fun getView(position: Int, convertView: View?, c: Context?): View? {
21+
override fun getView(position: Int, convertView: View?, context: Context?): View? {
2222
var convertView = convertView
2323
val holder: ViewHolder
2424

2525
if (convertView == null) {
2626
holder = ViewHolder()
2727

28-
convertView = LayoutInflater.from(c).inflate(
28+
convertView = LayoutInflater.from(context).inflate(
2929
R.layout.list_item_barchart, null
3030
)
3131
holder.chart = convertView.findViewById(R.id.chart)

app/src/main/kotlin/info/appdev/chartexample/listviewitems/ChartItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import info.appdev.charting.data.ChartData
1111
abstract class ChartItem internal constructor(var chartData: ChartData<*>) {
1212
abstract val itemType: Int
1313

14-
abstract fun getView(position: Int, convertView: View?, c: Context?): View?
14+
abstract fun getView(position: Int, convertView: View?, context: Context?): View?
1515

1616
companion object {
1717
const val TYPE_BARCHART: Int = 0

app/src/main/kotlin/info/appdev/chartexample/listviewitems/LineChartItem.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ import info.appdev.charting.data.ChartData
1111
import info.appdev.charting.data.LineData
1212
import info.appdev.chartexample.R
1313

14-
class LineChartItem(cd: ChartData<*>, c: Context) : ChartItem(cd) {
15-
private val typeface: Typeface? = Typeface.createFromAsset(c.assets, "OpenSans-Regular.ttf")
14+
class LineChartItem(chartData: ChartData<*>, context: Context) : ChartItem(chartData) {
15+
private val typeface: Typeface? = Typeface.createFromAsset(context.assets, "OpenSans-Regular.ttf")
1616

1717
override val itemType: Int
1818
get() = TYPE_LINECHART
1919

2020
@SuppressLint("InflateParams")
21-
override fun getView(position: Int, convertView: View?, c: Context?): View {
21+
override fun getView(position: Int, convertView: View?, context: Context?): View {
2222
var convertView = convertView
2323
val holder: ViewHolder
2424

2525
if (convertView == null) {
2626
holder = ViewHolder()
2727

28-
convertView = LayoutInflater.from(c).inflate(
28+
convertView = LayoutInflater.from(context).inflate(
2929
R.layout.list_item_linechart, null
3030
)
3131
holder.chart = convertView.findViewById(R.id.chart)

app/src/main/kotlin/info/appdev/chartexample/listviewitems/PieChartItem.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import info.appdev.charting.formatter.PercentFormatter
1818
import info.appdev.charting.utils.ColorTemplate
1919
import info.appdev.chartexample.R
2020

21-
class PieChartItem(cd: ChartData<*>, c: Context) : ChartItem(cd) {
22-
private val typeface: Typeface? = Typeface.createFromAsset(c.assets, "OpenSans-Regular.ttf")
21+
class PieChartItem(chartData: ChartData<*>, context: Context) : ChartItem(chartData) {
22+
private val typeface: Typeface? = Typeface.createFromAsset(context.assets, "OpenSans-Regular.ttf")
2323
private val centerText: SpannableString
2424

2525
init {
@@ -30,14 +30,14 @@ class PieChartItem(cd: ChartData<*>, c: Context) : ChartItem(cd) {
3030
get() = TYPE_PIECHART
3131

3232
@SuppressLint("InflateParams")
33-
override fun getView(position: Int, convertView: View?, c: Context?): View {
33+
override fun getView(position: Int, convertView: View?, context: Context?): View {
3434
var convertView = convertView
3535
val holder: ViewHolder
3636

3737
if (convertView == null) {
3838
holder = ViewHolder()
3939

40-
convertView = LayoutInflater.from(c).inflate(
40+
convertView = LayoutInflater.from(context).inflate(
4141
R.layout.list_item_piechart, null
4242
)
4343
holder.chart = convertView.findViewById(R.id.chart)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,15 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt
527527
/**
528528
* draws the grid background
529529
*/
530-
protected fun drawGridBackground(c: Canvas) {
530+
protected fun drawGridBackground(canvas: Canvas) {
531531
if (mDrawGridBackground) {
532532
// draw the grid background
533533

534-
c.drawRect(viewPortHandler.contentRect, mGridBackgroundPaint!!)
534+
canvas.drawRect(viewPortHandler.contentRect, mGridBackgroundPaint!!)
535535
}
536536

537537
if (this.isDrawBordersEnabled) {
538-
c.drawRect(viewPortHandler.contentRect, mBorderPaint!!)
538+
canvas.drawRect(viewPortHandler.contentRect, mBorderPaint!!)
539539
}
540540
}
541541

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
379379
/**
380380
* Draws the description text in the bottom right corner of the chart (per default)
381381
*/
382-
protected fun drawDescription(c: Canvas) {
382+
protected fun drawDescription(canvas: Canvas) {
383383
// check if description should be drawn
384384

385385
if (description.isEnabled) {
@@ -402,7 +402,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
402402
y = position.y
403403
}
404404

405-
c.drawText(description.text!!, x, y, mDescPaint)
405+
canvas.drawText(description.text!!, x, y, mDescPaint)
406406
}
407407
}
408408

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ open class LineChartRenderer(
251251
/**
252252
* Draws a normal line.
253253
*/
254-
protected fun drawLinear(c: Canvas, dataSet: ILineDataSet) {
254+
protected fun drawLinear(canvas: Canvas, dataSet: ILineDataSet) {
255255
val entryCount = dataSet.entryCount
256256

257257
val pointsPerEntryPair = if (dataSet.isDrawSteppedEnabled) 4 else 2
@@ -266,14 +266,14 @@ open class LineChartRenderer(
266266
val canvas: Canvas? = if (dataSet.isDashedLineEnabled) {
267267
bitmapCanvas
268268
} else {
269-
c
269+
canvas
270270
}
271271

272272
xBounds.set(dataProvider, dataSet)
273273

274274
// if drawing filled is enabled
275275
if (dataSet.isDrawFilledEnabled && entryCount > 0) {
276-
drawLinearFill(c, dataSet, trans!!, xBounds)
276+
drawLinearFill(canvas, dataSet, trans!!, xBounds)
277277
}
278278

279279
// more than 1 color

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

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ open class Fill {
7777
}
7878

7979
fun fillRect(
80-
c: Canvas, paint: Paint,
80+
canvas: Canvas, paint: Paint,
8181
left: Float, top: Float, right: Float, bottom: Float,
8282
gradientDirection: Direction?, mRoundedBarRadius: Float
8383
) {
@@ -90,12 +90,12 @@ open class Fill {
9090
}
9191

9292
if (this.isClipPathSupported) {
93-
val save = c.save()
93+
val save = canvas.save()
9494

95-
c.clipRect(left, top, right, bottom)
96-
c.drawColor(mFinalColor!!)
95+
canvas.clipRect(left, top, right, bottom)
96+
canvas.drawColor(mFinalColor!!)
9797

98-
c.restoreToCount(save)
98+
canvas.restoreToCount(save)
9999
} else {
100100
// save
101101
val previous = paint.style
@@ -105,7 +105,7 @@ open class Fill {
105105
paint.style = Paint.Style.FILL
106106
paint.color = mFinalColor!!
107107

108-
c.drawRoundRect(RectF(left, top, right, bottom), mRoundedBarRadius, mRoundedBarRadius, paint)
108+
canvas.drawRoundRect(RectF(left, top, right, bottom), mRoundedBarRadius, mRoundedBarRadius, paint)
109109

110110
// restore
111111
paint.color = previousColor
@@ -142,7 +142,7 @@ open class Fill {
142142

143143
paint.shader = gradient
144144

145-
c.drawRoundRect(RectF(left, top, right, bottom), mRoundedBarRadius, mRoundedBarRadius, paint)
145+
canvas.drawRoundRect(RectF(left, top, right, bottom), mRoundedBarRadius, mRoundedBarRadius, paint)
146146
}
147147

148148
Type.DRAWABLE -> {
@@ -151,13 +151,15 @@ open class Fill {
151151
}
152152

153153
drawable!!.setBounds(left.toInt(), top.toInt(), right.toInt(), bottom.toInt())
154-
drawable!!.draw(c)
154+
drawable!!.draw(canvas)
155155
}
156156
}
157157
}
158158

159159
fun fillPath(
160-
c: Canvas, path: Path, paint: Paint,
160+
canvas: Canvas,
161+
path: Path,
162+
paint: Paint,
161163
clipRect: RectF?
162164
) {
163165
when (this.type) {
@@ -169,12 +171,12 @@ open class Fill {
169171
}
170172

171173
if (clipRect != null && this.isClipPathSupported) {
172-
val save = c.save()
174+
val save = canvas.save()
173175

174-
c.clipPath(path)
175-
c.drawColor(mFinalColor!!)
176+
canvas.clipPath(path)
177+
canvas.drawColor(mFinalColor!!)
176178

177-
c.restoreToCount(save)
179+
canvas.restoreToCount(save)
178180
} else {
179181
// save
180182
val previous = paint.style
@@ -184,7 +186,7 @@ open class Fill {
184186
paint.style = Paint.Style.FILL
185187
paint.color = mFinalColor!!
186188

187-
c.drawPath(path, paint)
189+
canvas.drawPath(path, paint)
188190

189191
// restore
190192
paint.color = previousColor
@@ -196,16 +198,16 @@ open class Fill {
196198
val gradient = LinearGradient(
197199
0f,
198200
0f,
199-
c.width.toFloat(),
200-
c.height.toFloat(),
201+
canvas.width.toFloat(),
202+
canvas.height.toFloat(),
201203
this.gradientColors!!,
202204
this.gradientPositions,
203205
Shader.TileMode.MIRROR
204206
)
205207

206208
paint.shader = gradient
207209

208-
c.drawPath(path, paint)
210+
canvas.drawPath(path, paint)
209211
}
210212

211213
Type.DRAWABLE -> {
@@ -215,18 +217,18 @@ open class Fill {
215217

216218
ensureClipPathSupported()
217219

218-
val save = c.save()
219-
c.clipPath(path)
220+
val save = canvas.save()
221+
canvas.clipPath(path)
220222

221223
drawable!!.setBounds(
222224
if (clipRect == null) 0 else clipRect.left.toInt(),
223225
if (clipRect == null) 0 else clipRect.top.toInt(),
224-
if (clipRect == null) c.width else clipRect.right.toInt(),
225-
if (clipRect == null) c.height else clipRect.bottom.toInt()
226+
if (clipRect == null) canvas.width else clipRect.right.toInt(),
227+
if (clipRect == null) canvas.height else clipRect.bottom.toInt()
226228
)
227-
drawable!!.draw(c)
229+
drawable!!.draw(canvas)
228230

229-
c.restoreToCount(save)
231+
canvas.restoreToCount(save)
230232
}
231233
}
232234
}

0 commit comments

Comments
 (0)