Skip to content

Commit b918360

Browse files
committed
Cosmetic
1 parent ccdc84c commit b918360

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,14 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec
182182
}
183183

184184
R.id.actionToggleCircles -> {
185-
binding.chart1.data?.dataSets?.forEach {
186-
val set = it as LineDataSet
185+
binding.chart1.data?.dataSets?.map { it as LineDataSet }?.forEach { set ->
187186
set.setDrawCircles(!set.isDrawCirclesEnabled)
188187
}
189188
binding.chart1.invalidate()
190189
}
191190

192191
R.id.actionToggleCubic -> {
193-
binding.chart1.data?.dataSets?.forEach {
194-
val set = it as LineDataSet
192+
binding.chart1.data?.dataSets?.map { it as LineDataSet }?.forEach { set ->
195193
set.lineMode = if (set.lineMode == LineDataSet.Mode.CUBIC_BEZIER)
196194
LineDataSet.Mode.LINEAR
197195
else
@@ -201,8 +199,7 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec
201199
}
202200

203201
R.id.actionToggleStepped -> {
204-
binding.chart1.data?.dataSets?.forEach {
205-
val set = it as LineDataSet
202+
binding.chart1.data?.dataSets?.map { it as LineDataSet }?.forEach { set ->
206203
set.lineMode = if (set.lineMode == LineDataSet.Mode.STEPPED)
207204
LineDataSet.Mode.LINEAR
208205
else
@@ -212,8 +209,7 @@ class LineChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelec
212209
}
213210

214211
R.id.actionToggleHorizontalCubic -> {
215-
binding.chart1.data?.dataSets?.forEach {
216-
val set = it as LineDataSet
212+
binding.chart1.data?.dataSets?.map { it as LineDataSet }?.forEach { set ->
217213
set.lineMode = if (set.lineMode == LineDataSet.Mode.HORIZONTAL_BEZIER)
218214
LineDataSet.Mode.LINEAR
219215
else

0 commit comments

Comments
 (0)